[英]How can i convert cahracters drawn with draw(rect:) into strings?
I am working on a project where I need to draw alphabetic characters using draw(rect:) method.
我正在做一个项目,我需要使用 draw(rect:) 方法绘制字母字符。 Until now I am able to draw these hand-drawn characters but I am unable to export these characters as strings.
到目前为止,我能够绘制这些手绘字符,但我无法将这些字符导出为字符串。 I tried to get the drawn alphabets using screenshots and OCR but all other algorithms just detect the test and resample the text to redefined shapes whereas, i need to convert the drawn character as it to the string or ".ttf".
我尝试使用屏幕截图和 OCR 获取绘制的字母,但所有其他算法只是检测测试并将文本重新采样为重新定义的形状,而我需要将绘制的字符转换为字符串或“.ttf”。
If your goal is to have the user draw characters and turn their drawings into a font, you have your work cut out for you.如果您的目标是让用户绘制字符并将他们的绘图转换为字体,那么您的工作已经完成。
I suggest you have the user draw one character at a time.我建议您让用户一次绘制一个字符。 Since you know which one they are drawing, you know what character you're getting.
既然你知道他们在画哪一个,你就知道你得到的是什么角色。
You'd then need to convert their raw gestures into a series of bezier curves.然后,您需要将他们的原始手势转换为一系列贝塞尔曲线。 Then you'd need to encode those bezier curves into a glyph in the font you are building.
然后,您需要将这些贝塞尔曲线编码为您正在构建的字体中的字形。
I've never figured out how to generate Bezier curves from points along the curve, since the middle control points for a Bezier curve don't lie along the curve.我从来没有弄清楚如何从曲线上的点生成贝塞尔曲线,因为贝塞尔曲线的中间控制点并不沿着曲线。 I've read that it's possible however.
我读过这是可能的。
As to encoding the curves into a glyph in TrueType font format, I got nuttin'.至于将曲线编码为 TrueType 字体格式的字形,我疯了。 I suggest googling it.
我建议谷歌搜索它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.