Note
I was wrong. Figma gives the font settings just fine. It was my makeshift
font service that was not functioning properly.
I’m no expert when it comes to fonts, but as far as my experience goes Figma doesn’t give you the variable size font settings through its developer tooling.
In my case, the fonts that we use have something what I interpret to
be “named” settings (debugName
in python’s fontTools
library).
These are what our designer uses in Figma, and Figma’s tooling fails
to properly give the settings behind those names.
Using fontTools
in python one can extract those settings:
>>> from fontTools import ttLib
>>> f = ttLib.TTFont('./path/to/the/font.ttf')
>>> for i in f['fvar'].instances:
... print(f["name"].getDebugName(i.subfamilyNameID), i.coordinates, i.subfamilyNameID)
...
Condensed Hairline {'wdth': 37.0, 'wght': 1.0} 258
Condensed Thin {'wdth': 37.0, 'wght': 100.0} 259
Condensed Extra Light {'wdth': 37.0, 'wght': 200.0} 260
<snip>
The coordinates
neatly maps to the css settings:
font-variation-settings: 'wdth' 100.0, 'wght' 400.0;