Skip to content

Commit

Permalink
add compile option to force variableFeatures=False
Browse files Browse the repository at this point in the history
this can be useful to debugging, comparing build time of new vs old build pipeline, or if one wants to ensure no binary changes occur when updating the compiler
  • Loading branch information
anthrotype committed Jan 11, 2024
1 parent 91e76cd commit 52ca46a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Lib/ufo2ft/_compilers/baseCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ def _compileNeededSources(self, designSpaceDoc):

# If the feature files are compatible between the sources, we can save
# time by building a variable feature file right at the end.
can_optimize_features = _featuresCompatible(designSpaceDoc)
can_optimize_features = self.variableFeatures and _featuresCompatible(
designSpaceDoc
)
if can_optimize_features:
self.logger.info("Features are compatible across masters; building later")

Expand Down
4 changes: 2 additions & 2 deletions Lib/ufo2ft/_compilers/interpolatableOTFCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ufo2ft.constants import SPARSE_OTF_MASTER_TABLES, CFFOptimization
from ufo2ft.outlineCompiler import OutlineOTFCompiler
from ufo2ft.preProcessor import OTFPreProcessor
from ufo2ft.util import prune_unknown_kwargs

from .baseCompiler import BaseInterpolatableCompiler
from .otfCompiler import OTFCompiler
Expand Down Expand Up @@ -50,8 +51,7 @@ def compile(self, ufos):
),
}
# Remove interpolatable-specific args
del args["variableFontNames"]
del args["excludeVariationTables"]
args = prune_unknown_kwargs(args, OTFCompiler)
compiler = OTFCompiler(**args)
self.extraSubstitutions = save_extraSubstitutions
otfs.append(compiler.compile(ufo))
Expand Down
1 change: 1 addition & 0 deletions Lib/ufo2ft/_compilers/variableCFF2sCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ class VariableCFF2sCompiler(InterpolatableOTFCompiler):
cffVersion: int = 2
optimizeCFF: CFFOptimization = CFFOptimization.SPECIALIZE
excludeVariationTables: tuple = ()
variableFeatures: bool = True
1 change: 1 addition & 0 deletions Lib/ufo2ft/_compilers/variableTTFsCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ class VariableTTFsCompiler(InterpolatableTTFCompiler):
autoUseMyMetrics: bool = True
dropImpliedOnCurves: bool = False
allQuadratic: bool = True
variableFeatures: bool = True

0 comments on commit 52ca46a

Please sign in to comment.