Instantiator usWidthClass
See original GitHub issueWe are having an issue with the instantiator regarding usWidthClass
.
Our Variable font ‘wdth’ axis spans from 50 to 275 (%) but the instantiator tries to map it to 50-200 because of the example of the OpenType specs:
https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswidthclass
https://github.com/googlefonts/fontmake/blob/24312140ce114691363f62b9293c46b10f95c0b4/Lib/fontmake/instantiator.py#L633
Why should the ‘wdth’ need to stick to the min=50 max=200 example of the specs? a variable font may as well have very different min-max values and still the named instance would need distinctive usWidthClass
values.
In our case the last two wider instances get the same usWidthClass value of 9 (because both are beyond 200) and this is creating the confusion.
width_user_value = min(max(wdth_user_value, 50), 200)
: wouldn’t it be more correct to replace the arbitrary values of 50 and 200 by the VF wdth max
and wdth min
then map accordingly the instances values?
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
we could allow it to be greater than 9, but it certainly can’t be less than 0 because it’s an unsigned 16 bit integer in the OS/2 spec…
Your suggestion is correct, actually we are using the OS/2 fields for sorting because not all fonts are instantiated from a VF (so they have not instance coordinates).