[instancer/CFF2] Comment

This commit is contained in:
Behdad Esfahbod 2024-05-14 18:26:35 -06:00
parent c22f7d5af4
commit c06e8ba1e8

View File

@ -576,11 +576,15 @@ def changeTupleVariationAxisLimit(var, axisTag, axisLimit):
def instantiateCFF2( def instantiateCFF2(
varfont, axisLimits, *, round=round, specialize=True, generalize=False varfont, axisLimits, *, round=round, specialize=True, generalize=False
): ):
# The algorithm here is rather simple: Take all blend operations and # The algorithm here is rather simple:
# store their deltas in the (otherwise empty) CFF2 VarStore. Then, #
# instantiate the VarStore with the given axis limits, and read back # Take all blend operations and store their deltas in the (otherwise empty)
# the new deltas. This is done for both the CharStrings and the Private # CFF2 VarStore. Then, instantiate the VarStore with the given axis limits,
# dicts. # and read back the new deltas. This is done for both the CharStrings and
# the Private dicts.
#
# Then prune unused things and possibly drop the VarStore if it's empty.
# In which case, TODO: downgrade to CFF table.
log.info("Instantiating CFF2 table") log.info("Instantiating CFF2 table")
@ -590,6 +594,7 @@ def instantiateCFF2(
topDict = cff.topDictIndex[0] topDict = cff.topDictIndex[0]
varStore = topDict.VarStore.otVarStore varStore = topDict.VarStore.otVarStore
if not varStore: if not varStore:
# TODO Downgrade to CFF if requested.
return return
cff.desubroutinize() cff.desubroutinize()
@ -804,6 +809,8 @@ def instantiateCFF2(
for private in privateDicts: for private in privateDicts:
del private.vstore del private.vstore
# TODO Downgrade to CFF if requested.
def _instantiateGvarGlyph( def _instantiateGvarGlyph(
glyphname, glyf, gvar, hMetrics, vMetrics, axisLimits, optimize=True glyphname, glyf, gvar, hMetrics, vMetrics, axisLimits, optimize=True