55

How can I combine two fonts automatically, so glyphs those are not available in the first font, but available in second one can be merged into the first font?

3 Answers 3

61

This is an easy task with fontforge.

Addendum from comments: Before merging, click Element > Font info... in both fonts first to see whether the values like em size match. Otherwise, update either to match the values of the other font. This prevents issues like different character sizes. This info should probably be added to the answer. – Cristan

First, you want to open the font with the missing glyphs and select Element -> Merge Fonts. In this example, the glyphs for E and F are the ones missing. Element->Merge Fonts

Select the font from which you want to pull glyphs. You will be asked whether you want to keep the existing kerning; you most likely want to select No here, but if you get strange results close fontforge and try again with Yes.Kerning dialog

The missing glyphs should be added in a few moments:Result in main fontforge window

Finally, do File -> Generate Fonts and export your font to a desired location.

12
  • 3
    This seems to only work if the fonts are of a similar em height, otherwise the glyphs get all funky.
    – Hanna
    Dec 12, 2017 at 0:39
  • 1
    Could you explain why we would most likely not want to preserve kerning? I
    – Maarten
    Jun 10, 2019 at 11:03
  • 1
    @Maarten I probably figured that one out by trial-and-error, but no, I can't really. It's been 7 years!
    – dset0x
    Jun 10, 2019 at 16:39
  • 1
    I merged missing font and it looks normal in Fontforge but it made the fonts microscopic at a normal font size. Is there an explanation? I thought Kerning is spacing, no horizontal height. Jun 10, 2019 at 20:33
  • 5
    Before merging, click Element > Font info... in both fonts first to see whether the values like em size match. Otherwise, update either to match the values of the other font. This prevents issues like different character sizes. This info should probably be added to the answer.
    – Cristan
    Nov 20, 2019 at 13:35
11

Also have a look at Google's Google Noto Font project and their Noto Tools merge_fonts.py script.

Or use the merge function from the FontTools project. The old dead link location is: here.

For more deep info on making/adding fonts to Windows, look at my other answer here.

0
9
  1. Install FontForge
  2. It usually gets installed at C:\Program Files (x86)\FontForgeBuilds\bin, so add that to your path environmental variable(Only for Windows Users).
  3. Paste the below code in a file named mergefonts.ff
#!/usr/local/bin/fontforge
Open($1)
SelectAll()
ScaleToEm(Strtol($3))
Generate("1.ttf")
Close()
Open($2)
SelectAll()
ScaleToEm(Strtol($3))
Generate("2.ttf")
Close()
Open("1.ttf")
MergeFonts("2.ttf")
Generate($4)
Close()
  1. mergefonts.ff Script Usage:
fontforge -lang=ff -script mergefonts.ff <font1> <font2> <font_size_in_em> <output_merged_font>

Example:

fontforge -lang=ff -script mergefonts.ff font1.ttf font2.ttf 1000 mergedfont.ttf

References:
Link1
Link2
Link3

6
  • Should this works on linux ?
    – Hugolpz
    Mar 19, 2021 at 23:57
  • yeah, should work fine on linux also Mar 20, 2021 at 12:25
  • Tested, works. Thank you. Ubuntu has Font Forge already installed so it's very easy. If someone is enthusiastic and fluent in bash it could be interesting to make it work for n font files. But it already works as of now.
    – Hugolpz
    Mar 20, 2021 at 13:44
  • __import__('subprocess').getoutput([r'C:\Program Files (x86)\FontForgeBuilds\bin\fontforge.exe', "-lang", "ff" , '-script' , r'scriptpath', r"font1path", r"font2path", '2048', r'newfontpath'])
    – tejasvi88
    Sep 2, 2021 at 15:29
  • This seems to work good. However the order in which the fonts are merged seems important. Also the metadata from the first font (font-family, copyright, etc) is inherited strictly from the first font. Aug 15 at 23:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .