Skip to content

Commit 0910d73

Browse files
committed
[dehinter.font] modify handling of glyf table instruction set removal in composite glyphs
1 parent e78bcb5 commit 0910d73

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/dehinter/font.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ def remove_glyf_instructions(tt):
131131
for glyph in tt["glyf"].glyphs.values():
132132
glyph.expand(tt["glyf"])
133133
if hasattr(glyph, "program") and glyph.program.bytecode != array.array("B", []):
134-
glyph.program.bytecode = array.array("B", [])
135-
glyph_number += 1
134+
if glyph.isComposite():
135+
del glyph.program
136+
glyph_number += 1
137+
else:
138+
glyph.program.bytecode = array.array("B", [])
139+
glyph_number += 1
136140
return glyph_number
137141

138142

tests/test_main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def font_validator(filepath):
2424
assert "TTFA" not in tt
2525
for glyph in tt["glyf"].glyphs.values():
2626
glyph.expand(tt["glyf"])
27+
if glyph.isComposite():
28+
assert not hasattr(glyph, "program")
2729
if hasattr(glyph, "program"):
2830
assert glyph.program.bytecode == array.array("B", [])
2931
assert tt["gasp"].gaspRange == {65535: 15}

0 commit comments

Comments
 (0)