[merge] Don’t create TTFont then throw it away
The font is opened later, so use that.
This commit is contained in:
parent
5299a3cb83
commit
a53ded3b31
@ -1057,18 +1057,16 @@ class Merger(object):
|
|||||||
A :class:`fontTools.ttLib.TTFont` object. Call the ``save`` method on
|
A :class:`fontTools.ttLib.TTFont` object. Call the ``save`` method on
|
||||||
this to write it out to an OTF file.
|
this to write it out to an OTF file.
|
||||||
"""
|
"""
|
||||||
# Take first input file sfntVersion
|
|
||||||
sfntVersion = ttLib.TTFont(fontfiles[0]).sfntVersion
|
|
||||||
mega = ttLib.TTFont(sfntVersion=sfntVersion)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settle on a mega glyph order.
|
# Settle on a mega glyph order.
|
||||||
#
|
#
|
||||||
fonts = [ttLib.TTFont(fontfile) for fontfile in fontfiles]
|
fonts = [ttLib.TTFont(fontfile) for fontfile in fontfiles]
|
||||||
|
|
||||||
glyphOrders = [font.getGlyphOrder() for font in fonts]
|
glyphOrders = [font.getGlyphOrder() for font in fonts]
|
||||||
megaGlyphOrder = self._mergeGlyphOrders(glyphOrders)
|
megaGlyphOrder = self._mergeGlyphOrders(glyphOrders)
|
||||||
|
|
||||||
|
# Take first input file sfntVersion
|
||||||
|
sfntVersion = fonts[0].sfntVersion
|
||||||
|
|
||||||
cffTables = []
|
cffTables = []
|
||||||
if sfntVersion == "OTTO":
|
if sfntVersion == "OTTO":
|
||||||
for i, font in enumerate(fonts):
|
for i, font in enumerate(fonts):
|
||||||
@ -1080,7 +1078,7 @@ class Merger(object):
|
|||||||
# it's safer, in case tables were loaded to provide glyph names.
|
# it's safer, in case tables were loaded to provide glyph names.
|
||||||
fonts = [ttLib.TTFont(fontfile) for fontfile in fontfiles]
|
fonts = [ttLib.TTFont(fontfile) for fontfile in fontfiles]
|
||||||
|
|
||||||
if len(cffTables):
|
if sfntVersion == "OTTO":
|
||||||
for font, glyphOrder, cffTable in zip(fonts, glyphOrders, cffTables):
|
for font, glyphOrder, cffTable in zip(fonts, glyphOrders, cffTables):
|
||||||
font.setGlyphOrder(glyphOrder)
|
font.setGlyphOrder(glyphOrder)
|
||||||
# Rename CFF CharStrings to match the new glyphOrder.
|
# Rename CFF CharStrings to match the new glyphOrder.
|
||||||
@ -1090,6 +1088,7 @@ class Merger(object):
|
|||||||
for font, glyphOrder in zip(fonts, glyphOrders):
|
for font, glyphOrder in zip(fonts, glyphOrders):
|
||||||
font.setGlyphOrder(glyphOrder)
|
font.setGlyphOrder(glyphOrder)
|
||||||
|
|
||||||
|
mega = ttLib.TTFont(sfntVersion=sfntVersion)
|
||||||
mega.setGlyphOrder(megaGlyphOrder)
|
mega.setGlyphOrder(megaGlyphOrder)
|
||||||
|
|
||||||
for font in fonts:
|
for font in fonts:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user