How do I convert a TTF into individual PNG character images?

4

3

I want to generate a .PNG image for every glyph in a .TTF font file. How do I do that?

clickbait

Posted 2018-07-09T01:13:23.527

Reputation: 739

1You mean other than typing one letter in Photoshop, save, next letter, save...? – Tetsujin – 2018-07-10T07:22:58.860

1In FontForge you can export one glyph as image. But if you want automation then it's more complicated – Mikhail V – 2018-07-13T15:11:38.477

Answers

3

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

Mikhail V

Posted 2018-07-09T01:13:23.527

Reputation: 550

0

This online app does just that very easily and visual - although is not open source :( it could help to quickly generate transparent glyphs pngs from given ttf to quickly test. and a manifest of all the glyphs dimensions and features: http://kvazars.com/littera/

cancerbero

Posted 2018-07-09T01:13:23.527

Reputation: 109

1

Can you please include the summary of that application on your answer? Also see How do I recommend software in my answers?.

– CaldeiraG – 2019-07-16T12:46:30.753