parent
55192edb0c
commit
0e9c48e6ab
@ -487,6 +487,13 @@ class TTFont(object):
|
|||||||
# in combination with the Adobe Glyph List (AGL).
|
# in combination with the Adobe Glyph List (AGL).
|
||||||
#
|
#
|
||||||
self._getGlyphNamesFromCmap()
|
self._getGlyphNamesFromCmap()
|
||||||
|
elif len(glyphOrder) < self['maxp'].numGlyphs:
|
||||||
|
#
|
||||||
|
# Not enough names found in the 'post' table.
|
||||||
|
# Can happen when 'post' format 1 is improperly used on a font that
|
||||||
|
# has more than 258 glyphs (the lenght of 'standardGlyphOrder').
|
||||||
|
#
|
||||||
|
self._getGlyphNamesFromCmap()
|
||||||
else:
|
else:
|
||||||
self.glyphOrder = glyphOrder
|
self.glyphOrder = glyphOrder
|
||||||
else:
|
else:
|
||||||
|
BIN
Tests/ttLib/data/bogus_post_format_1.ttf
Normal file
BIN
Tests/ttLib/data/bogus_post_format_1.ttf
Normal file
Binary file not shown.
@ -4,6 +4,7 @@ import re
|
|||||||
import random
|
import random
|
||||||
from fontTools.feaLib.builder import addOpenTypeFeaturesFromString
|
from fontTools.feaLib.builder import addOpenTypeFeaturesFromString
|
||||||
from fontTools.ttLib import TTFont, TTLibError, newTable, registerCustomTableClass, unregisterCustomTableClass
|
from fontTools.ttLib import TTFont, TTLibError, newTable, registerCustomTableClass, unregisterCustomTableClass
|
||||||
|
from fontTools.ttLib.standardGlyphOrder import standardGlyphOrder
|
||||||
from fontTools.ttLib.tables.DefaultTable import DefaultTable
|
from fontTools.ttLib.tables.DefaultTable import DefaultTable
|
||||||
from fontTools.ttLib.tables._c_m_a_p import CmapSubtable
|
from fontTools.ttLib.tables._c_m_a_p import CmapSubtable
|
||||||
import pytest
|
import pytest
|
||||||
@ -143,6 +144,13 @@ def test_setGlyphOrder_also_updates_glyf_glyphOrder():
|
|||||||
assert font["glyf"].glyphOrder == new_order
|
assert font["glyf"].glyphOrder == new_order
|
||||||
|
|
||||||
|
|
||||||
|
def test_getGlyphOrder_not_true_post_format_1():
|
||||||
|
# https://github.com/fonttools/fonttools/issues/2736
|
||||||
|
font = TTFont(os.path.join(DATA_DIR, "bogus_post_format_1.ttf"))
|
||||||
|
hmtx = font["hmtx"]
|
||||||
|
assert len(hmtx.metrics) > len(standardGlyphOrder)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("lazy", [None, True, False])
|
@pytest.mark.parametrize("lazy", [None, True, False])
|
||||||
def test_ensureDecompiled(lazy):
|
def test_ensureDecompiled(lazy):
|
||||||
# test that no matter the lazy value, ensureDecompiled decompiles all tables
|
# test that no matter the lazy value, ensureDecompiled decompiles all tables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user