-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Just noticed: the code that handles setting the variable grade in PR #25 uses the font-variation-settings with the "wght" flag:
Lines 52 to 53 in 934cf16
| fontVariationSettings: | |
| '"wght" ' + scaleInRange(tb_ming, tb_maxg, width_ratio) |
This is based on the current 0.9.9 code:
Line 56 in 567a0e3
| var variableGradeSettings = '"wght" ' + gradeMath; |
I'm new to variable fonts, but based on MDN's Variable Font Guide, it looks like font grade is specified not using the "wght" flag but rather the "GRAD" flag (capitalized because grade is a (less common) custom variation axis, unlike weight, which is a (more commonly used) registered axis).
The font used in demo.html, Source Sans Variable - Roman, contains only the weight variation axis. So perhaps the parameter names should be changed from min/maxWidthVariableGrade to min/maxWidthFontWeight? The Variable part could be dropped, since both variable and non-variable fonts' weights can be set using just the font-weight CSS property (non-variable fonts will just round to the nearest available weight); the font-variation-settings property that only works with variable fonts wouldn't need to be used.
The VariableGrade params could be retained in addition to FontWeight params, and the code could be updated accordingly, though a variable font with a grade axis should be used to demonstrate it.