Generate TTF from PNG/SVG files using FontForge

一笑奈何 提交于 2021-02-08 11:38:41

问题


I'm trying to generate a ttf font file from a bunch of SVGs or PNGs. Every time I try, I get the error:

"Warning: Font contained no glyphs"

I've tried this on Mac and Linux:

font = fontforge.font()
glyph = font.createChar(65, "font1")
glyph.importOutlines("1.png")
glyph2 = font.createChar(66, "font2")
glyph2.importOutlines("2.png")
glyph3 = font.createChar(67, "font3")
glyph3.importOutlines("3.png")
font.generate("output.ttf")

I tried the hints on: Import a sequence of .svg files into FontForge as glyphs and output a font file

but still couldn't get it to work.

If anyone has any ideas on a better library I can call from commmandline to convert SVG to TTF, that would be great.

来源:https://stackoverflow.com/questions/53269493/generate-ttf-from-png-svg-files-using-fontforge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!