fontforge - Script to merge fonts to add glyphs
Asked Answered
M

1

7

I have two .ttf font files, one of which contains the glyphs that I need to merge to the other font file. Using the GUI, there will be a dialog box saying

Do you want to retain kerning information from the selected font when one of the glyphs being kerned will come from the base font?

I'll need to choose No for this. Upon generating the merged font, there will be a warning saying that the font uses unconventional em size. The font should be generated with errors such as Missing points at extrema, which is okay.

Now, this is all done via GUI and I'd have to merge a lot of font files so I chose to do the script.

#!/usr/local/bin/fontforge
i = 2
while(i < $argc)
    Open($1)
    MergeFonts($argv[i])
    MergeFeature($1)
    Generate($argv[i])
    i = i + 1
endloop

With this, I'm getting error MergeFeature: Failed to find kern info in file thus failing the generation of font. Is there anything that I am missing?

Madera answered 19/7, 2017 at 5:48 Comment(0)
S
1

If you do not wish to include the kerning information, remove the line:

MergeFeature($1)

This ultimately calls LoadKerningDataFromMetricsFile which fails due to the font file not having kerning metrics included.

According to the documentation:

This command will allow you to search for an adobe feature file (.fea) for feature/lookup information or an afm, ofm, tfm, pfm or mac resource file containing kerning pairs for the specified font. In many cases it will not be needed because when FontForge opens a .pfa or .pfb font it will automagically search for an appropriate .afm file in the same place.

Standin answered 3/4, 2019 at 0:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.