Class SkiaFontSource
Where the Skia backend finds substitutes for fonts a document does not embed. The default reads
the installed fonts (Installed, the catalog the Direct2D backend,
editing and PDF/A choose from), then asks Skia's font manager by family name. A host without
installed fonts, such as a browser, passes a catalog of the fonts it bundles
(ForDirectory(string)) or overrides the two loaders. On Android the
installed catalog is /system/fonts with Android's stand-ins for the Windows families
(ForAndroid(string)), so the default works there as it is.
public class SkiaFontSource
- Inheritance
-
SkiaFontSource
- Inherited Members
Constructors
SkiaFontSource(SystemFontCatalog?)
Creates a font source.
public SkiaFontSource(SystemFontCatalog? catalog = null)
Parameters
catalogSystemFontCatalogThe fonts to choose substitutes from; null uses Installed.
Properties
Catalog
Faces matched by name, design and class (Match(string?, bool, bool, bool, bool, bool)); read on first use.
public SystemFontCatalog Catalog { get; }
Property Value
HasCharacterFaces
True when the source names faces for single characters (FindCharacterFace(int, SkiaTextHint)), as a host that bundles fonts by script does (the web demo's Noto fonts). Text then takes each character that no substitute of the chain has from the face named for it. False by default, so the chain alone decides, as on Windows and Android.
public virtual bool HasCharacterFaces { get; }
Property Value
IsCharacterIndexPending
True when FindCharacterFace(int, SkiaTextHint) cannot answer until the host fetched what tells it which face has a character (an index of the bundled faces). The text then waits, as for a pending face.
public virtual bool IsCharacterIndexPending { get; }
Property Value
Methods
FindCharacterFace(int, SkiaTextHint)
The face that has codePoint, for a character that the substitutes of the
chain lack; null when the source has none, or cannot tell yet (IsCharacterIndexPending).
hint tells faces that share characters apart (Han in Chinese, Japanese and Korean faces).
public virtual SystemFontFace? FindCharacterFace(int codePoint, SkiaTextHint hint)
Parameters
codePointinthintSkiaTextHint
Returns
IsPending(SystemFontFace)
True when Load(SystemFontFace) answered null for face only because its file is
not here yet: a host that fetches fonts on demand (a browser) loads it and draws the page again.
The text then waits for that face instead of falling through to the next substitute, so
that only the face it would be drawn with is fetched. False by default.
public virtual bool IsPending(SystemFontFace face)
Parameters
faceSystemFontFace
Returns
IsPending(string, bool, bool)
As IsPending(SystemFontFace), for the face MatchFamily(string, bool, bool) would load for the family.
public virtual bool IsPending(string family, bool bold, bool italic)
Parameters
Returns
Load(SystemFontFace)
Loads a face of Catalog; null when it cannot be read.
public virtual SKTypeface? Load(SystemFontFace face)
Parameters
faceSystemFontFace
Returns
LoadInstance(SystemFontFace, int, bool)
The instance of a variable font at weight (100–900), so bold text gets the
real bold design instead of an emboldened regular: Android 12 and later ship Roboto as one
variable font. Null when the face is not a variable font or the platform's font manager has no
such instance; the caller then simulates the weight. SkiaSharp 3.116 has no API to set a
variation axis, so the instance comes from Skia's font manager: Android's reads
/system/etc/fonts.xml, which names an axis value for every weight of a variable family.
Only on Android by default; Windows ships static bold faces for the families substitution uses.
public virtual SKTypeface? LoadInstance(SystemFontFace face, int weight, bool italic)
Parameters
faceSystemFontFaceweightintitalicbool
Returns
MatchFamily(string, bool, bool)
A face of the named family nearest the style asked for, from Skia's font manager; else the face that stands in for the family by the catalog's aliases (Android: Roboto for Arial); null when neither has it.
public virtual SKTypeface? MatchFamily(string family, bool bold, bool italic)