Skip to content

Commit

Permalink
[varc] Use multiVarStore instead of GDEF varStore
Browse files Browse the repository at this point in the history
That's what we agreed upon.
  • Loading branch information
behdad committed Apr 23, 2024
1 parent 3c9ce87 commit 8166168
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Lib/fontTools/ttLib/ttGlyphSet.py
Expand Up @@ -288,7 +288,7 @@ def _evaluateCondition(condition, fvarAxes, location, instancer):
elif condition.Format == 2:
# ConditionValue
value = condition.DefaultValue
value += instancer[condition.VarIdx]
value += instancer[condition.VarIdx][0]
return value > 0

Check warning on line 292 in Lib/fontTools/ttLib/ttGlyphSet.py

View check run for this annotation

Codecov / codecov/patch

Lib/fontTools/ttLib/ttGlyphSet.py#L290-L292

Added lines #L290 - L292 were not covered by tests
elif condition.Format == 3:
# ConditionAnd
Expand Down Expand Up @@ -333,19 +333,13 @@ def _draw(self, pen, isPointPen):
instancer = MultiVarStoreInstancer(
varc.MultiVarStore, fvarAxes, self.glyphSet.location
)
gdef = glyphSet.font.get("GDEF") if "GDEF" in glyphSet.font else None
gdefInstancer = VarStoreInstancer(
getattr(gdef.table, "VarStore") if gdef is not None else None,
fvarAxes,
self.glyphSet.location,
)

for comp in glyph.components:

if comp.flags & VarComponentFlags.HAVE_CONDITION:
condition = varc.ConditionList.ConditionTable[comp.conditionIndex]
if not _evaluateCondition(
condition, fvarAxes, self.glyphSet.location, gdefInstancer
condition, fvarAxes, self.glyphSet.location, instancer
):
continue

Expand Down

0 comments on commit 8166168

Please sign in to comment.