Skip to content

Commit

Permalink
Disable the GPOS optimization while building the VF masters
Browse files Browse the repository at this point in the history
  • Loading branch information
belluzj committed Mar 15, 2022
1 parent 21c9b2d commit d0de0e2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Lib/ufo2ft/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import logging
from enum import IntEnum
import os

from fontTools import varLib
from fontTools.otlLib.optimize.gpos import GPOS_COMPACT_MODE_ENV_KEY

from ufo2ft.constants import SPARSE_OTF_MASTER_TABLES, SPARSE_TTF_MASTER_TABLES
from ufo2ft.featureCompiler import (
Expand Down Expand Up @@ -537,6 +539,9 @@ def compileVariableTTF(designSpaceDoc, **kwargs):
excludeVariationTables = kwargs.pop("excludeVariationTables")
optimizeGvar = kwargs.pop("optimizeGvar")

# Disable GPOS compaction while building masters because the compaction
# will be undone anyway by varLib merge and then done again on the VF
gpos_compact_value = os.environ.pop(GPOS_COMPACT_MODE_ENV_KEY, None)
ttfDesignSpace = compileInterpolatableTTFsFromDS(
designSpaceDoc,
**{
Expand All @@ -548,6 +553,8 @@ def compileVariableTTF(designSpaceDoc, **kwargs):
),
},
)
if gpos_compact_value is not None:
os.environ[GPOS_COMPACT_MODE_ENV_KEY] = gpos_compact_value

logger.info("Building variable TTF font")

Expand Down Expand Up @@ -596,6 +603,9 @@ def compileVariableCFF2(designSpaceDoc, **kwargs):

excludeVariationTables = kwargs.pop("excludeVariationTables")

# Disable GPOS compaction while building masters because the compaction
# will be undone anyway by varLib merge and then done again on the VF
gpos_compact_value = os.environ.pop(GPOS_COMPACT_MODE_ENV_KEY, None)
otfDesignSpace = compileInterpolatableOTFsFromDS(
designSpaceDoc,
**{
Expand All @@ -607,6 +617,8 @@ def compileVariableCFF2(designSpaceDoc, **kwargs):
),
},
)
if gpos_compact_value is not None:
os.environ[GPOS_COMPACT_MODE_ENV_KEY] = gpos_compact_value

logger.info("Building variable CFF2 font")

Expand Down

0 comments on commit d0de0e2

Please sign in to comment.