Class SkiaFontManager
public class SkiaFontManager
- Inheritance
-
SkiaFontManager
- Inherited Members
- Extension Methods
Fields
ThrowIfFailedToCreateFont
public static bool ThrowIfFailedToCreateFont
Field Value
Properties
DefaultTypeface
public static SKTypeface DefaultTypeface { get; }
Property Value
FontRegistrar
public static IFontRegistrar FontRegistrar { get; }
Property Value
Fonts
public Dictionary<string, SKTypeface> Fonts { get; set; }
Property Value
Initialized
public bool Initialized { get; set; }
Property Value
Instance
public static SkiaFontManager Instance { get; }
Property Value
Manager
public static SKFontManager Manager { get; }
Property Value
Methods
CanRender(SKTypeface, int)
public bool CanRender(SKTypeface typeface, int character)
Parameters
typefaceSKTypefacecharacterint
Returns
ClearCharacterCache()
Clears the character-to-typeface cache. Call this if fonts are dynamically loaded/unloaded at runtime.
public static void ClearCharacterCache()
DetectUnicodeBlock(int)
Detects the Unicode block category for a given code point. This is cross-platform logic used to optimize font matching.
public static UnicodeBlock DetectUnicodeBlock(int codePoint)
Parameters
codePointintUnicode code point
Returns
- UnicodeBlock
Unicode block category
FindBestTypefaceForString(string)
public static (SKTypeface, int) FindBestTypefaceForString(string text)
Parameters
textstring
Returns
- (SKTypeface, int)
GetAlias(string, FontWeight)
public static string GetAlias(string alias, FontWeight weight)
Parameters
aliasstringweightFontWeight
Returns
GetAlias(string, int)
public static string GetAlias(string alias, int weight)
Parameters
Returns
GetCharacterCacheSize()
Gets the current size of the character cache for diagnostics.
public static int GetCharacterCacheSize()
Returns
GetEmbeddedResourceNames()
Get the list of all emdedded resources in the assembly.
public static string[] GetEmbeddedResourceNames()
Returns
- string[]
An array of fully qualified resource names
GetEmbeddedResourceStream(Assembly, string)
public static Stream GetEmbeddedResourceStream(Assembly assembly, string resourceFileName)
Parameters
Returns
GetEmbeddedResourceStream(string)
Takes the full name of a resource and loads it in to a stream.
public static Stream GetEmbeddedResourceStream(string resourceName)
Parameters
resourceNamestringAssuming an embedded resource is a file called info.png and is located in a folder called Resources, it will be compiled in to the assembly with this fully qualified name: Full.Assembly.Name.Resources.info.png. That is the string that you should pass to this method.
Returns
GetEmbeededFont(string, Assembly, string)
public SKTypeface GetEmbeededFont(string filename, Assembly assembly, string alias = null)
Parameters
Returns
GetFont(string)
public SKTypeface GetFont(string alias)
Parameters
aliasstring
Returns
GetFont(string, int)
public SKTypeface GetFont(string fontFamily, int fontWeight)
Parameters
Returns
GetRegisteredAlias(string, int)
public static string GetRegisteredAlias(string alias, int weight)
Parameters
Returns
GetWeightEnum(int)
Gets the closest enum value to the given weight. Like 590 would return Semibold.
public static FontWeight GetWeightEnum(int weight)
Parameters
weightint
Returns
Initialize()
public void Initialize()
MatchCharacter(int)
Matches a Unicode character to an appropriate typeface with caching. This method is thread-safe and optimized for high-frequency calls.
public static SKTypeface MatchCharacter(int character)
Parameters
characterintUnicode code point to match
Returns
- SKTypeface
SKTypeface that can render the character, or null if no match found
RegisterWeight(string, FontWeight)
public static void RegisterWeight(string alias, FontWeight weight)
Parameters
aliasstringweightFontWeight
StringToUnicodeValues(string)
public static List<int> StringToUnicodeValues(string text)
Parameters
textstring