Skip to content

Commit

Permalink
[>64k:glyf] Support decoding 24bit GlyphID in composites
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Jul 12, 2022
1 parent 2089239 commit 181d3bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Lib/fontTools/ttLib/tables/_g_l_y_f.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,11 +1378,19 @@ def getComponentInfo(self):
return self.glyphName, trans

def decompile(self, data, glyfTable):
flags, glyphID = struct.unpack(">HH", data[:4])
flags = struct.unpack(">H", data[:2])[0]
self.flags = int(flags)
data = data[2:]

if self.flags & GID_IS_24BIT:
glyphID = struct.unpack(">I", b'\0'+data[:3])[0]
data = data[3:]
else:
glyphID = struct.unpack(">H", data[:2])[0]
data = data[2:]

glyphID = int(glyphID)
self.glyphName = glyfTable.getGlyphName(int(glyphID))
data = data[4:]
self.glyphName = glyfTable.getGlyphName(glyphID)

if self.flags & ARG_1_AND_2_ARE_WORDS:
if self.flags & ARGS_ARE_XY_VALUES:
Expand Down

0 comments on commit 181d3bc

Please sign in to comment.