Merge pull request #2212 from fonttools/mutator-trivial-fixes

Mutator trivial fixes
This commit is contained in:
Cosimo Lupo 2021-03-04 10:51:28 +00:00 committed by GitHub
commit e41c3b8b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 9 deletions

View File

@ -1315,7 +1315,7 @@ def parseArgs(args):
"locargs",
metavar="AXIS=LOC",
nargs="*",
help="List of space separated locations. A location consist in "
help="List of space separated locations. A location consists of "
"the tag of a variation axis, followed by '=' and one of number, "
"number:number or the literal string 'drop'. "
"E.g.: wdth=100 or wght=75.0:125.0 or wght=drop",

View File

@ -345,14 +345,8 @@ def instantiateVariableFont(varfont, location, inplace=False, overlap=True):
# Change maxp attributes as IDEF is added
if 'maxp' in varfont:
maxp = varfont['maxp']
if hasattr(maxp, "maxInstructionDefs"):
maxp.maxInstructionDefs += 1
else:
setattr(maxp, "maxInstructionDefs", 1)
if hasattr(maxp, "maxStackElements"):
maxp.maxStackElements = max(len(loc), maxp.maxStackElements)
else:
setattr(maxp, "maxInstructionDefs", len(loc))
setattr(maxp, "maxInstructionDefs", 1 + getattr(maxp, "maxInstructionDefs", 0))
setattr(maxp, "maxStackElements", max(len(loc), getattr(maxp, "maxStackElements", 0)))
if 'name' in varfont:
log.info("Pruning name table")