3

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.

  • are you sure you are trying to access Typeface in a collection? This works fine in skiasharp, what I had problem with and actually experienced the same problem as you, was accessing a named instance of a variable font. – Maku Nov 16 '22 at 10:06

0 Answers0