Python – How do I rename glyphs in TrueType fonts using TTX/fontTools?

How do I rename glyphs in TrueType fonts using TTX/fontTools?… here is a solution to the problem.

How do I rename glyphs in TrueType fonts using TTX/fontTools?

I’m upgrading a TrueType font created with a legacy code page to create a copy of Unicode. I’m playing with Python TTX/fontTools but haven’t figured it out yet:
1. Rename the glyph
2. Merge glyphs from two font files?

Can someone help?

P.S. I also tried Robofab but made a mistake when creating the UFO file.

Solution

Maybe these blog entries by FontGeek can help you? Two of them are dealing with TTX/fontttools….


Basically, you need to do it in three steps:

  1. Run ttx to convert the font file to an (editable) XML representation.
  2. Edit in the XML file.
  3. Run ttx again to convert the XML back to a valid font file.

Related Problems and Solutions