Skia paragraph does not support granular font weights

16 views
Skip to first unread message

Yosof

unread,
Nov 10, 2025, 5:06:55 PM (3 days ago) Nov 10
to skia-discuss
The paragraph has only three weights depending on the backend used.
On windows with direct write:
from 100 to 500 is thin
from 501 to 899 is thick
from 900 it is thicker

On linux with freetype and fontconfig:
from 100 to 549 is thin
from 550 to 899 is thick
from 900 it is thicker

How does apps depending on skia manage to get granular font weights?
Here is a fiddle demonstrating the problem:

And another question:
Does skia::textlayout::TextStyle::setFontSize(float) expect size in points or pixels because I'm getting slightly different size from what direct write layout is giving.

paul....@gmail.com

unread,
Nov 11, 2025, 11:41:04 PM (2 days ago) Nov 11
to skia-discuss
Hi Yosef

Are you using a variable font with a wght axis?  Then you could try using SkTypeface::makeClone(SkFontArguments) and use the setVariationDesignPostion() method on SkFontArguments.
I haven't tried it myself, but it looks like it'll do what you want.

If you are not using a variable font, then you are obviously limited to the font weights you have installed.

Paul



Reply all
Reply to author
Forward
0 new messages