[GX] Use Microsoft/OpenType weight class for weight axis

https://www.microsoft.com/typography/otspec/os2.htm#wtc
This commit is contained in:
Sascha Brawer 2015-06-26 22:03:25 +02:00
parent f83337dca3
commit 6cab1e6c1d

View File

@ -37,15 +37,16 @@ def AddFontVariations(font):
weight = Axis() weight = Axis()
weight.axisTag = "wght" weight.axisTag = "wght"
weight.nameID = AddName(font, "Weight").nameID weight.nameID = AddName(font, "Weight").nameID
weight.minValue, weight.defaultValue, weight.maxValue = (0.48, 1.0, 3.2) weight.minValue, weight.defaultValue, weight.maxValue = (100, 400, 900)
fvar.axes.append(weight) fvar.axes.append(weight)
# https://www.microsoft.com/typography/otspec/os2.htm#wtc
for name, wght in ( for name, wght in (
("Thin", 0.48), ("Thin", 100),
("Light", 0.8), ("Light", 300),
("Regular", 1.0), ("Regular", 400),
("Bold", 1.95), ("Bold", 700),
("Black", 3.2)): ("Black", 900)):
inst = NamedInstance() inst = NamedInstance()
inst.nameID = AddName(font, name).nameID inst.nameID = AddName(font, name).nameID
inst.coordinates = {"wght": wght} inst.coordinates = {"wght": wght}