Javascript在画布上生成虚线字体 [英] Javascript generate dotted fonts on canvas

查看:140
本文介绍了Javascript在画布上生成虚线字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找如何在A-Z的canvas标签中创建字母字体的Dotted字体。有一个简单的方法来完成这个吗?我想创建一个工具来教孩子如何写。

I am looking at ways to create Dotted letter fonts for alphabets from A-Z in a canvas tag . Is there an easy way to accomplish this?. I want to create a tool to teach toddlers how to write.

一种方法来实现这一点是在后台有一个图像,但我想看看是否有是更好的方法。

One way to achieve this is to have an image in the background but I'm looking to see if there is a better way to do this

请指教我如何做的例子或任何建议。

Please point me to examples on how to do this or any suggestions on getting started.

推荐答案

各种想法:


  1. 创建模式,并在调用 fillText()时使用。

  1. Create a pattern and use that in your call to fillText(). This will not necessarily align the dots on letter strokes, however.

使用笔触创建自己的字体,然后将其绘制为虚线(我的示例)。

Create your own font out of strokes, and then draw it as a dashed line (my example).

创建您自己的字体,然后使用SVG绘制它与 stroke-dasharray

Create your own font out of strokes, and then draw it using SVG with stroke-dasharray.

查找 Dotline 儿童的跟踪字体打印清除虚线将其嵌入CSS 将其嵌入SVG

这篇关于Javascript在画布上生成虚线字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆