Use the same range as Skia for the weight axis
With this change, the "Thin" instance now renders fine, too. Apparently, the axis values need to be positive; this was not clear to me from reading the specification.
This commit is contained in:
parent
97c7168749
commit
ef98f8ac12
@ -14,12 +14,7 @@
|
|||||||
# is *not* the case for the normal Roboto fonts that can be downloaded
|
# is *not* the case for the normal Roboto fonts that can be downloaded
|
||||||
# from Google. This demo script prints a warning for any problematic
|
# from Google. This demo script prints a warning for any problematic
|
||||||
# glyphs; in the resulting font, these glyphs will not be interpolated
|
# glyphs; in the resulting font, these glyphs will not be interpolated
|
||||||
# at all (so they appear always in the "Regular" weight).
|
# and get rendered in the "Regular" weight.
|
||||||
#
|
|
||||||
# TODO: Currently, the resulting font is structurally valid, and it
|
|
||||||
# looks fine for "Thin", "Regular", "Bold" and "Black". However, the
|
|
||||||
# "Light" instance appears identical to "Thin". Still need to figure out
|
|
||||||
# the reason for this.
|
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# $ mkdir /tmp/Roboto && cp Roboto-*.ttf /tmp/Roboto
|
# $ mkdir /tmp/Roboto && cp Roboto-*.ttf /tmp/Roboto
|
||||||
@ -42,15 +37,15 @@ 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.3, 1.0, 1.7)
|
weight.minValue, weight.defaultValue, weight.maxValue = (0.48, 1.0, 3.2)
|
||||||
fvar.axes.append(weight)
|
fvar.axes.append(weight)
|
||||||
|
|
||||||
for name, wght in (
|
for name, wght in (
|
||||||
("Thin", -0.3),
|
("Thin", 0.48),
|
||||||
("Light", -0.7),
|
("Light", 0.8),
|
||||||
("Regular", 1.0),
|
("Regular", 1.0),
|
||||||
("Bold", 1.3),
|
("Bold", 1.95),
|
||||||
("Black", 1.7)):
|
("Black", 3.2)):
|
||||||
inst = NamedInstance()
|
inst = NamedInstance()
|
||||||
inst.nameID = AddName(font, name).nameID
|
inst.nameID = AddName(font, name).nameID
|
||||||
inst.coordinates = {"wght": wght}
|
inst.coordinates = {"wght": wght}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user