mutator: also clamp usWeightClass between valid 1...1000

This commit is contained in:
Cosimo Lupo 2018-06-18 19:44:40 +01:00
parent 8fcbf78d8b
commit 0234b9dbd5
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482

View File

@ -137,7 +137,9 @@ def instantiateVariableFont(varfont, location, inplace=False):
]
if "wght" in location and "OS/2" in varfont:
varfont["OS/2"].usWeightClass = otRound(location["wght"])
varfont["OS/2"].usWeightClass = otRound(
max(1, min(location["wght"], 1000))
)
if "wdth" in location:
wdth = location["wdth"]
for percent, widthClass in sorted(OS2_WIDTH_CLASS_VALUES.items()):