I know this problem might be related with how OpenType.js reads a variable font, but…
When I list a variable font (with its instances) in a webpage using opentype.js, it prints everything as expected except for one instance that is “Undefined”
MyFont_VF - undefined
As far as I know, this is because in the fvar the Regular version points to the subfamilyNameID=2 and is ignored. The other NameInstances point to a subfamilyName=259 or another.
Is there a way to overwrite this? I have already tried with “Regular” or “Normal” in the Typographic Style Names but doesn’t seem to change anything.
If I change the instance name to anything else but Regular AND change the axis coordinate to 401 to trick and mismatch the Variable Font Origin, it DOES define that instance and another NamedInstance in the FVAR (via TTX).
Do you have a clue how can I do this without tricking the values?
Can you show the STAT table of your font? Maybe it has something to do with the “elided fallback name” that is not present or interpreted incorrectly by opentype.js.
I think so… but shouldn’t the “Name Table Entry” values overwrite and point to the ID=17? Because even if I activate those values, the FVAR points to ID=2.
Your STAT table looks fine. The bug must indeed lie at opentype.js.
My guess is that it doesn’t handle the “elided fallback name” mechanism correctly.
Your Regular style is at wght=400 and ital = 0, both locations have flags=2 set in STAT. That means the name of those axis values should not be used by applications to build the full font name. As no style name is left then, the name ID from ElidedFallbackNameID should be used, which also points to ID2 (Regular).