Skip to content

Commit

Permalink
[glyf] compile empty table as 1 null byte to make OTS and Windows happy
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Feb 12, 2020
1 parent 16bff17 commit 9c7cead
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/fontTools/ttLib/tables/_g_l_y_f.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ def compile(self, ttFont):
ttFont['loca'].set(locations)
if 'maxp' in ttFont:
ttFont['maxp'].numGlyphs = len(self.glyphs)
if not data:
# As a special case when all glyph in the font are empty, add a zero byte
# to the table, so that OTS doesn’t reject it, and to make the table work
# on Windows as well.
# See https://github.com/khaledhosny/ots/issues/52
data = b"\0"
return data

def toXML(self, writer, ttFont, splitGlyphs=False):
Expand Down

0 comments on commit 9c7cead

Please sign in to comment.