Skip to content

Commit

Permalink
[avar] Raise exception instead of assert
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Apr 3, 2024
1 parent ff4100f commit ed092f2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/fontTools/ttLib/tables/_a_v_a_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ def compile(self, ttFont):

def decompile(self, data, ttFont):
super().decompile(data, ttFont)
assert self.table.Version >= 0x00010000
self.majorVersion = self.table.Version >> 16
self.minorVersion = self.table.Version & 0xFFFF
if self.majorVersion not in (1, 2):
raise NotImplementedError("Unknown avar table version")
axisTags = [axis.axisTag for axis in ttFont["fvar"].axes]
for axis in axisTags:
self.segments[axis] = {}
Expand Down Expand Up @@ -142,7 +143,8 @@ def fromXML(self, name, attrs, content, ttFont):

def renormalizeLocation(self, location, font):

assert self.majorVersion in (1, 2), "Unknown avar table version"
if self.majorVersion not in (1, 2):
raise NotImplementedError("Unknown avar table version")

avarSegments = self.segments
mappedLocation = {}
Expand Down

0 comments on commit ed092f2

Please sign in to comment.