If a variable font has a 'wdth' (Width) axis, then the coordinate of its 'Regular' instance is required to be 100
, according to the OpenType specification's "registered axis" definition of wdth
, available at https://docs.microsoft.com/en-gb/typography/opentype/spec/dvaraxistag_wdth
Run this when the font...
- is a variable font
- has a wdth axis
Regular:wdth is 100.
The 'wdth' coordinate of the 'Regular' instance must be 100, but instead the default value is {regular_wdth_coord}.
cabinvfbeta/Cabin-VF.ttf
if regular_wdth_coord == 100:
yield PASS, pass_message
else:
yield FAIL, fail_message["reason"]
Our reference varfont has a good Regular wdth coordinate, so it should PASS the test:
regular_width_coord = regular_wdth_coord(ttFont)
print('Test PASS with a good Regular:wdth coordinate...')
status, message = list(check(ttFont, regular_width_coord))[-1]
assert status == PASS
We then change the value so it must FAIL:
ttFont["fvar"].instances[0].coordinates["wdth"] = 0
Then re-read the coord:
regular_width_coord = regular_wdth_coord(ttFont)
and now this should FAIL the test:
print('Test FAIL with a bad Regular:wdth coordinate (100)...')
status, message = list(check(ttFont, regular_width_coord))[-1]
assert status == FAIL