How to use a specific font style from a collection in Skia?

Skip to first unread message

John Carruthers

Sep 25, 2021, 5:15:59 PMSep 25
to skia-discuss

I am loading OpenType/TrueType font collections from memory to use for rendering text with Skia. The fonts in question are NOT active on the system running the application.

To do this I'm using (in SkiaSharp) SKTypeface.FromStream which takes a standard Stream that allows access to the blob of font data.

However, I can't seem to find a way to load multiple typefaces from the font collection: Skia seems to provide no overload that returns multiple Typeface instances and the ttcIndex on the various CreateTypeface do not appear to work: only returning NULL when specifying a non-zero index.

So my question is: how do you load all the typefaces in a TrueType Collection or OpenType Collection file using Skia? I can examine the typefaces myself to find adequate fallback if needed but I need to be able to render whichever typeface/style I choose from the collection.

Reply all
Reply to author
0 new messages