-
Where can I find an variable font that contain a axis value table with format 4? I would like to have one to test some feature. |
Beta Was this translation helpful? Give feedback.
Answered by
moi15moi
Mar 12, 2023
Replies: 1 comment
-
Since I couldn't found an font with axis value that has format 4, I created one with fonttools: from fontTools.ttLib.ttFont import TTFont
from fontTools.ttLib.tables import otTables
font = TTFont("original font.ttf")
axisValue = otTables.AxisValue()
axisValue.Format = 4
axisValue.Flags = XXX
axisValue.ValueNameID = XXX
axisValue.AxisValueRecord = []
# If you want to have an wght = 800 and ital = 0
for tag, value in (("wght", 800), ("ital", 0)):
rec = otTables.AxisValueRecord()
rec.AxisIndex = next(
i for i, a in enumerate(font["STAT"].table.DesignAxisRecord.Axis) if a.AxisTag == tag
)
rec.Value = value
axisValue.AxisValueRecord.append(rec)
font["STAT"].table.AxisValueArray.AxisValue.append(axisValue)
font.save("font.ttf") |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
moi15moi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since I couldn't found an font with axis value that has format 4, I created one with fonttools: