I want to generate a .PNG
image for every glyph in a .TTF
font file. How do I do that?
You can use Python with FontForge, it has a Python 2.7 interpreter.
On Windows: after installing FontForge, locate the "bin" in installation path and add it to the Windows system path, in my case it is:
c:\Program Files (x86)\FontForgeBuilds\bin\
This dir contains ffpython.exe
so after adding it to PATH you can directly run a .py
script in console.
> ffpython myscript.py
To export all glyphs you can use this simple script:
import fontforge
F = fontforge.open("perpetua.ttf")
for name in F:
filename = name + ".png"
# print name
F[name].export(filename)
# F[name].export(filename, 600) # set height to 600 pixels
documentation:
http://fontforge.github.io/python.html#Glyph
http://fontforge.github.io/python.html#Font
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments