revery-ui/revery

Font families: multi-variant font files are ignored

zbaylin opened this issue · 1 comments

This is a bug with the new font families implementation in #879. If a font contains more than one variant (as is supported in newer versions of OpenType and TrueType), we only render the normal variant [1].

It's not really a bug with my implementation, but rather an oversight in the code that's existed for a while and only really became evident with this.

(Mostly) @bryphe and I did some investigation and found that, in reason-skia, we hardcode 0 as the index for all fonts, as seen here:

let skiaTypeface = Skia.Typeface.makeFromFile(assetPath, 0);

The documentation on that function is sort of iffy, but I think it refers to a VariationIndex in OpenType fonts, at least:
https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#device-and-variationindex-tables

I don't think reason-font-manager gives us the index, so we might have to either patch it in to do that, or ditch it entirely.

[1]: This is only kind of true: it's whatever variant is at index 0, since we hardcode that.

So cool that this works now!