You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I think I understood Svg.Skia can't make use of fonts embedded in the Svg like this : @font-face {font-family:'Pacifico'; src: url("data:font/truetype;charset=utf-8;base64,AAEAAA...}
So I try to overcome the problem by using CustomTypefaceProvider but this code seems to have no effect :
Svg = new SKSvg(); var test = new CustomTypefaceProvider(@"C:\Fonts\Pacifico.ttf"); Svg.Settings.TypefaceProviders.Insert(0, test); Svg.Load(@"c:\TEMP\sample.svg"); canvas.DrawPicture(Svg.Picture, ref matrix);
With the text in svg defined like this : <text transform="matrix(34 0 0 34 56.9024 102.5916)" x="0" y="0" style="fill:#221E1F;font-family:'Pacifico';" font-size="1">Hello</text>
I can see in debug the font is loaded and added in the TypeFaceProviders collection, but that's all.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I think I understood Svg.Skia can't make use of fonts embedded in the Svg like this :
@font-face {font-family:'Pacifico'; src: url("data:font/truetype;charset=utf-8;base64,AAEAAA...}
So I try to overcome the problem by using CustomTypefaceProvider but this code seems to have no effect :
Svg = new SKSvg();
var test = new CustomTypefaceProvider(@"C:\Fonts\Pacifico.ttf");
Svg.Settings.TypefaceProviders.Insert(0, test);
Svg.Load(@"c:\TEMP\sample.svg");
canvas.DrawPicture(Svg.Picture, ref matrix);
With the text in svg defined like this :
<text transform="matrix(34 0 0 34 56.9024 102.5916)" x="0" y="0" style="fill:#221E1F;font-family:'Pacifico';" font-size="1">Hello</text>
I can see in debug the font is loaded and added in the TypeFaceProviders collection, but that's all.
Am I missing something ?
Beta Was this translation helpful? Give feedback.
All reactions