FontCollectionBase Class
Definition
public class FontCollectionBase
Methods
| Name | Description |
|---|---|
| GetEnumerator | No summary available. |
| TryAddFontSource | Attempts to add a font source to the font collection. |
| TryAddGlyphTypeface (3 overloads) | Attempts to add the specified Avalonia.Media.GlyphTypeface to the font collection. |
| TryCreateSyntheticGlyphTypeface | No summary available. |
| TryGetFamilyTypefaces | No summary available. |
| TryGetGlyphTypeface | No summary available. |
| TryGetNearestMatch | No summary available. |
| TryMatchCharacter | No summary available. |
GetEnumerator Method
public System.Collections.Generic.IEnumerator<Avalonia.Media.FontFamily> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<Avalonia.Media.FontFamily>
TryAddFontSource Method
Attempts to add a font source to the font collection.
public bool TryAddFontSource(Uri source)
Parameters
source Uri
The URI of the font source to add. This can be a file path, a resource URI, or another valid font source URI.
Returns
bool
if at least one font from the specified source was successfully added to the font collection; otherwise, .
Remarks
This method processes the specified font source and attempts to load all available
fonts from it. Fonts are added to the collection based on their family name and typographic family name (if
available). If the source is , the method returns .
TryAddGlyphTypeface overloads
TryAddGlyphTypeface Method
Attempts to add the specified Avalonia.Media.GlyphTypeface to the font collection.
public bool TryAddGlyphTypeface(Avalonia.Media.GlyphTypeface glyphTypeface)
Parameters
glyphTypeface Avalonia.Media.GlyphTypeface
The glyph typeface to add. Must not be and must have a non-empty Avalonia.Media.GlyphTypeface.FamilyName.
Returns
bool
if the glyph typeface was successfully added to the collection; otherwise, .
Remarks
This method checks the Avalonia.Media.GlyphTypeface.FamilyName and, if applicable, the typographic family name and other family names provided by the Avalonia.Media.GlyphTypeface interface. If any of these names can be associated with the glyph typeface, the typeface is added to the collection. The method ensures that duplicate entries are not added.
TryAddGlyphTypeface Method
Attempts to add the specified glyph typeface to the collection using the provided key.
public bool TryAddGlyphTypeface(Avalonia.Media.GlyphTypeface glyphTypeface, Avalonia.Media.Fonts.FontCollectionKey key)
Parameters
glyphTypeface Avalonia.Media.GlyphTypeface
The glyph typeface to add. Cannot be null, and its FamilyName property must not be null or empty.
key Avalonia.Media.Fonts.FontCollectionKey
The key that identifies the font collection to which the glyph typeface will be added.
Returns
bool
true if the glyph typeface was successfully added to the collection; otherwise, false.
Remarks
The method adds the glyph typeface using both its typographic family name and all available family names. If the glyph typeface or its family name is invalid, the method returns false and does not add the typeface.
TryAddGlyphTypeface Method
public bool TryAddGlyphTypeface(System.IO.Stream stream, Avalonia.Media.GlyphTypeface& glyphTypeface)
Parameters
stream System.IO.Stream
glyphTypeface Avalonia.Media.GlyphTypeface&
Returns
bool
TryCreateSyntheticGlyphTypeface Method
public bool TryCreateSyntheticGlyphTypeface(Avalonia.Media.GlyphTypeface glyphTypeface, Avalonia.Media.FontStyle style, Avalonia.Media.FontWeight weight, Avalonia.Media.FontStretch stretch, Avalonia.Media.GlyphTypeface& syntheticGlyphTypeface)
Parameters
glyphTypeface Avalonia.Media.GlyphTypeface
style Avalonia.Media.FontStyle
weight Avalonia.Media.FontWeight
stretch Avalonia.Media.FontStretch
syntheticGlyphTypeface Avalonia.Media.GlyphTypeface&
Returns
bool
TryGetFamilyTypefaces Method
public bool TryGetFamilyTypefaces(string familyName, System.Collections.Generic.IReadOnlyList<Avalonia.Media.Typeface>& familyTypefaces)
Parameters
familyName string
familyTypefaces System.Collections.Generic.IReadOnlyList<Avalonia.Media.Typeface>&
Returns
bool
TryGetGlyphTypeface Method
public bool TryGetGlyphTypeface(string familyName, Avalonia.Media.FontStyle style, Avalonia.Media.FontWeight weight, Avalonia.Media.FontStretch stretch, Avalonia.Media.GlyphTypeface& glyphTypeface)
Parameters
familyName string
style Avalonia.Media.FontStyle
weight Avalonia.Media.FontWeight
stretch Avalonia.Media.FontStretch
glyphTypeface Avalonia.Media.GlyphTypeface&
Returns
bool
TryGetNearestMatch Method
public bool TryGetNearestMatch(string familyName, Avalonia.Media.FontStyle style, Avalonia.Media.FontWeight weight, Avalonia.Media.FontStretch stretch, Avalonia.Media.GlyphTypeface& glyphTypeface)
Parameters
familyName string
style Avalonia.Media.FontStyle
weight Avalonia.Media.FontWeight
stretch Avalonia.Media.FontStretch
glyphTypeface Avalonia.Media.GlyphTypeface&
Returns
bool
TryMatchCharacter Method
public bool TryMatchCharacter(int codepoint, Avalonia.Media.FontStyle style, Avalonia.Media.FontWeight weight, Avalonia.Media.FontStretch stretch, string familyName, System.Globalization.CultureInfo culture, Avalonia.Media.Typeface& match)
Parameters
codepoint int
style Avalonia.Media.FontStyle
weight Avalonia.Media.FontWeight
stretch Avalonia.Media.FontStretch
familyName string
culture System.Globalization.CultureInfo
match Avalonia.Media.Typeface&
Returns
bool
Properties
Count Property
public int Count { get; set; }
Item Property
public Avalonia.Media.FontFamily Item { get; set; }
Key Property
public Uri Key { get; set; }