Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fontTools config #540

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Lib/ufo2ft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def call_postprocessor(otf, ufo, glyphSet, kwargs, **overrides):
skipExportGlyphs=None,
debugFeatureFile=None,
notdefGlyph=None,
config={},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosimo: call this fontToolsConfig

)

compileOTF_args = {
Expand Down Expand Up @@ -531,6 +532,15 @@ def compileVariableTTF(designSpaceDoc, **kwargs):
# No need to post-process intermediate fonts.
postProcessorClass=None,
),
"config": {
**kwargs.get("config", {}),
# Whichever level of GPOS optimization the user has chosen, we
# know here that the optimization would be pointless, because
# the interpolatable OTFs will be merged by varLib, which
# un-does the optimization, then re-optimized differently after
# the merge.
"otlLib.optimize.gpos.mode": 0,
},
}
)

Expand Down Expand Up @@ -588,6 +598,15 @@ def compileVariableCFF2(designSpaceDoc, **kwargs):
# No need to post-process intermediate fonts.
postProcessorClass=None,
),
"config": {
**kwargs.get("config", {}),
# Whichever level of GPOS optimization the user has chosen, we
# know here that the optimization would be pointless, because
# the interpolatable OTFs will be merged by varLib, which
# un-does the optimization, then re-optimized differently after
# the merge.
"otlLib.optimize.gpos.mode": 0,
},
}
)

Expand Down
4 changes: 3 additions & 1 deletion Lib/ufo2ft/outlineCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ def __init__(
self._glyphBoundingBoxes = None
self._fontBoundingBox = None
self._compiledGlyphs = None
self._config = kwargs.get("config", {})

def compile(self):
"""
Compile the OpenType binary.
"""
self.otf = TTFont(sfntVersion=self.sfntVersion)
self.otf = TTFont(sfntVersion=self.sfntVersion, config=self._config)

# only compile vertical metrics tables if vhea metrics are defined
vertical_metrics = [
Expand Down Expand Up @@ -1101,6 +1102,7 @@ def __init__(
glyphOrder=glyphOrder,
tables=tables,
notdefGlyph=notdefGlyph,
**kwargs,
)
self.optimizeCFF = optimizeCFF
self._defaultAndNominalWidths = None
Expand Down