Hi Skia experts,
In my project, I need to render fonts similarly to how web browsers do it. Apparently, when it comes to variable fonts, Skia and browsers (I checked Chrome and Firefox) render them differently by default.
This is how it's rendered by Skia:
This is how it's rendered by Chrome and Firefox:
Note, no additional CSS properties were used in the HTML page.
As you can see, the browser version is much wider than the Skia version.
I can achieve the same effect by maxing out the width of character by using font arguments:
const Variation::Coordinate position[] = {
{ SkSetFourByteTag('w','d','t','h'), 100.0f },
};
SkFontArguments params;
params.setVariationDesignPosition({position, std::size(position)});
sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(soulcraft), params);
However, I don't know in advance what fonts my app will be used with. So, the question is, how do I render fonts with Skia in the same way web browsers do? Is it possible to find out what values should be used for font arguments?