how SkFontMgr to release font from font file

4 views
Skip to first unread message

Elliot Liu

unread,
Jul 8, 2022, 12:55:48 PMJul 8
to skia-discuss
recently, I tried to use SkParagraph to render text.
And create new FontProvider, and register the font from font file.

But be noted the font data will not be released even I exit the function call.

Any idea will be appreciated. 
Code mostly like below:

sk_sp<SkData> fontData = SkData::MakeFromFileName(m_fontFile.c_str());
    sk_sp<TypefaceFontProvider> fontProvider = sk_make_sp<TypefaceFontProvider>();
    auto newFont = SkTypeface::MakeFromData(fontData);

    if (fontProvider->registerTypeface(newFont, m_fontName) == 0)
Reply all
Reply to author
Forward
0 new messages