merge: Merge multiple fonts into one¶
fontTools.merge
provides both a library and a command line interface
(fonttools merge
) for merging multiple fonts together.
-
class
fontTools.merge.
Merger
(options=None)[source]¶ Font merger.
This class merges multiple files into a single OpenType font, taking into account complexities such as OpenType layout (
GSUB
/GPOS
) tables and cross-font metrics (e.g.hhea.ascent
is set to the maximum value across all the fonts).If multiple glyphs map to the same Unicode value, and the glyphs are considered sufficiently different (that is, they differ in any of paths, widths, or height), then subsequent glyphs are renamed and a lookup in the
locl
feature will be created to disambiguate them. For example, if the arguments are an Arabic font and a Latin font and both contain a set of parentheses, the Latin glyphs will be renamed toparenleft#1
andparenright#1
, and a lookup will be inserted into the tolocl
feature (creating it if necessary) under thelatn
script to substituteparenleft
withparenleft#1
etc.Restrictions:
- All fonts must currently have TrueType outlines (
glyf
table). Merging fonts with CFF outlines is not supported.
- All fonts must currently have TrueType outlines (
All fonts must have the same units per em.
- If duplicate glyph disambiguation takes place as described above then the
fonts must have a
GSUB
table.
-
options
¶ Currently unused.