Skip to content

Typeface

Wiesław Šoltés edited this page Aug 26, 2022 · 3 revisions

Loading custom typeface using CustomTypefaceProvider

var typefaceProvider = new CustomTypefaceProvider("font.ttf");
SvgTextExtensions.s_typefaceProviders.Insert(0, typefaceProvider);
var typefaceProvider = new CustomTypefaceProvider(stream);
SvgTextExtensions.s_typefaceProviders.Insert(0, typefaceProvider);

Loading custom typeface using FontManagerTypefacerovider

foreach (var typefaceProvider in SvgTextExtensions.s_typefaceProviders)
{
    if (typefaceProvider is FontManagerTypefacerovider fontManagerTypefacerovider)
    {
        fontManagerTypefacerovider.CreateTypeface("font.ttf");
        break;
    }
}
foreach (var typefaceProvider in SvgTextExtensions.s_typefaceProviders)
{
    if (typefaceProvider is FontManagerTypefacerovider fontManagerTypefacerovider)
    {
        fontManagerTypefacerovider..CreateTypeface(stream);
        break;
    }
}

Code

https://github.com/wieslawsoltes/Svg.Skia/tree/master/src/Svg.Skia/TypefaceProviders

Clone this wiki locally