Add warning log
This commit is contained in:
parent
0e9c48e6ab
commit
a2efac012c
@ -493,6 +493,7 @@ class TTFont(object):
|
|||||||
# Can happen when 'post' format 1 is improperly used on a font that
|
# Can happen when 'post' format 1 is improperly used on a font that
|
||||||
# has more than 258 glyphs (the lenght of 'standardGlyphOrder').
|
# has more than 258 glyphs (the lenght of 'standardGlyphOrder').
|
||||||
#
|
#
|
||||||
|
log.warning("'post' table format 1 discarded; font has more than 258 glyphs")
|
||||||
self._getGlyphNamesFromCmap()
|
self._getGlyphNamesFromCmap()
|
||||||
else:
|
else:
|
||||||
self.glyphOrder = glyphOrder
|
self.glyphOrder = glyphOrder
|
||||||
|
@ -144,11 +144,15 @@ 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():
|
def test_getGlyphOrder_not_true_post_format_1(caplog):
|
||||||
# https://github.com/fonttools/fonttools/issues/2736
|
# https://github.com/fonttools/fonttools/issues/2736
|
||||||
|
caplog.set_level("WARNING")
|
||||||
font = TTFont(os.path.join(DATA_DIR, "bogus_post_format_1.ttf"))
|
font = TTFont(os.path.join(DATA_DIR, "bogus_post_format_1.ttf"))
|
||||||
hmtx = font["hmtx"]
|
hmtx = font["hmtx"]
|
||||||
assert len(hmtx.metrics) > len(standardGlyphOrder)
|
assert len(hmtx.metrics) > len(standardGlyphOrder)
|
||||||
|
log_rec = caplog.records[-1]
|
||||||
|
assert log_rec.levelname == "WARNING"
|
||||||
|
assert "'post' table format 1 discarded" in log_rec.message
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("lazy", [None, True, False])
|
@pytest.mark.parametrize("lazy", [None, True, False])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user