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
Let's say that I want "font-family: foo;" to resolve to some specific typeface. In my example, I'm using Tinos. I can perform that lookup and return the typeface I want used. But then Svg.Skia calls FromFamilyName again but this time with the name specified in the typeface.
The path of execution is roughly:
A call to TypefaceProvider.FromFamilyName("foo", ...) returns Typeface("Tinos")
...
A call to TypefaceProvider.FromFamilyName("Tinos", ...) needs to return Typeface("Tinos") or the font I want won't get used.
The second call to FromFamilyName based on the result of the first call to FromFamilyName was unexpected. It seemed unnecessary, but I wonder if I'm missing something?
dotnet run allows both "foo" and "Tinos" to resolve to that font.
dotnet run -- --only-foo allows only "foo" to resolve to that font.
Both produce a PNG in the run directory just so I haven't fooled myself that the font isn't being used or something.
There are also many more calls to TypefaceProvider.FromFamilyName than I expected, but maybe that's intentional?
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm in a situation where I want to control exactly what fonts are available for use by an SVG render.
I've implemented a TypefaceProvider to this effect.
Let's say that I want
"font-family: foo;"to resolve to some specific typeface. In my example, I'm using Tinos. I can perform that lookup and return the typeface I want used. But then Svg.Skia callsFromFamilyNameagain but this time with the name specified in the typeface.The path of execution is roughly:
TypefaceProvider.FromFamilyName("foo", ...)returnsTypeface("Tinos")TypefaceProvider.FromFamilyName("Tinos", ...)needs to returnTypeface("Tinos")or the font I want won't get used.The second call to
FromFamilyNamebased on the result of the first call toFromFamilyNamewas unexpected. It seemed unnecessary, but I wonder if I'm missing something?https://github.com/oconnor0/bookish-broccoli demonstrates this all.
dotnet runallows both "foo" and "Tinos" to resolve to that font.dotnet run -- --only-fooallows only "foo" to resolve to that font.Both produce a PNG in the run directory just so I haven't fooled myself that the font isn't being used or something.
There are also many more calls to
TypefaceProvider.FromFamilyNamethan I expected, but maybe that's intentional?Beta Was this translation helpful? Give feedback.
All reactions