How to add a new glyph to a font with FontTools?

roipoussiere
roipoussiere Posts: 5
edited February 2 in Type Design Software

I'm trying to add a new glyph to a font. I managed to draw by glyph to a pen, then saved it to a glyph object with:

new_glyph = pen.glyph()

Now I would like to do something like:
font.getGlyphSet()["e_m"] = new_glyph
or (with a ttf font):

font["glyf"]["e_m"] = new_glyph
but I can't.

How to add a new glyph to a font with FontTools?

Thank you!

Tagged:

Comments

  • For anyone interested, the solution was to:

    1. create a new UFO;
    2. add the glyph to this UFO;
    3. compile this UFO to a font of the same type of the source font;
    4. merge the two fonts with fonttools.merge.