• Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • SixLabors.Fonts
      • ColorFontSupport
      • Font
      • FontCollection
      • FontCollectionExtensions
      • FontDescription
      • FontException
      • FontFamily
      • FontFamilyNotFoundException
      • FontMetrics
      • FontRectangle
      • FontStyle
      • Glyph
      • GlyphBounds
      • GlyphColor
      • GlyphLayoutMode
      • GlyphMetrics
      • GlyphMissingException
      • GlyphRendererParameters
      • GlyphType
      • HintingMode
      • HorizontalAlignment
      • HorizontalMetrics
      • IColorGlyphRenderer
      • IFontCollection
      • IGlyphRenderer
      • IGlyphRendererExtensions
      • IMetricsHeader
      • IReadOnlyFontCollection
      • IReadOnlySystemFontCollection
      • InvalidFontFileException
      • InvalidFontTableException
      • KerningMode
      • LayoutMode
      • LayoutModeExtensions
      • MissingFontTableException
      • SystemFonts
      • TextAlignment
      • TextAttributes
      • TextDecorations
      • TextDirection
      • TextJustification
      • TextMeasurer
      • TextOptions
      • TextRenderer
      • TextRun
      • VerticalAlignment
      • VerticalMetrics
      • WordBreaking
    • SixLabors.Fonts.Tables.AdvancedTypographic
      • FeatureTags
      • GlyphClassDef
      • Tag
    • SixLabors.Fonts.Tables.TrueType
      • TrueTypeGlyphMetrics
    • SixLabors.Fonts.Unicode
      • ArabicJoiningClass
      • ArabicJoiningGroup
      • ArabicJoiningType
      • BidiCharacterType
      • BidiClass
      • BidiPairedBracketType
      • CodePoint
      • GraphemeClusterClass
      • IndicPositionalCategory
      • IndicSyllabicCategory
      • LineBreakClass
      • MemoryExtensions
      • ScriptClass
      • SpanCodePointEnumerator
      • SpanGraphemeEnumerator
      • VerticalOrientationType
    • SixLabors.Fonts.WellKnownIds
      • KnownNameIds

    Class FontCollection

    Represents a collection of font families.

    Inheritance
    object
    FontCollection
    Implements
    IFontCollection
    IReadOnlyFontCollection
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: SixLabors.Fonts
    Assembly: SixLabors.Fonts.dll
    Syntax
    public sealed class FontCollection : IFontCollection, IReadOnlyFontCollection

    Constructors

    | Edit this page View Source

    FontCollection()

    Initializes a new instance of the FontCollection class.

    Declaration
    public FontCollection()

    Properties

    | Edit this page View Source

    Families

    Gets the collection of FontFamily in this IReadOnlyFontCollection using the invariant culture.

    Declaration
    public IEnumerable<FontFamily> Families { get; }
    Property Value
    Type Description
    IEnumerable<FontFamily>

    Methods

    | Edit this page View Source

    Add(Stream)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    Add(Stream, out FontDescription)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(Stream stream, out FontDescription description)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    FontDescription description

    The description of the added font.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    Add(Stream, CultureInfo)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(Stream stream, CultureInfo culture)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    CultureInfo culture

    The culture of the font to add.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    Add(Stream, CultureInfo, out FontDescription)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(Stream stream, CultureInfo culture, out FontDescription description)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    CultureInfo culture

    The culture of the font to add.

    FontDescription description

    The description of the added font.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    Add(string)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(string path)
    Parameters
    Type Name Description
    string path

    The filesystem path to the font file.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    Add(string, out FontDescription)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(string path, out FontDescription description)
    Parameters
    Type Name Description
    string path

    The filesystem path to the font file.

    FontDescription description

    The description of the added font.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    Add(string, CultureInfo)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(string path, CultureInfo culture)
    Parameters
    Type Name Description
    string path

    The filesystem path to the font file.

    CultureInfo culture

    The culture of the font to add.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    Add(string, CultureInfo, out FontDescription)

    Adds a font to the collection.

    Declaration
    public FontFamily Add(string path, CultureInfo culture, out FontDescription description)
    Parameters
    Type Name Description
    string path

    The filesystem path to the font file.

    CultureInfo culture

    The culture of the font to add.

    FontDescription description

    The description of the added font.

    Returns
    Type Description
    FontFamily

    The new FontFamily.

    | Edit this page View Source

    AddCollection(Stream)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    AddCollection(Stream, out IEnumerable<FontDescription>)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(Stream stream, out IEnumerable<FontDescription> descriptions)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    IEnumerable<FontDescription> descriptions

    The descriptions of the added fonts.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    AddCollection(Stream, CultureInfo)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(Stream stream, CultureInfo culture)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    CultureInfo culture

    The culture of the fonts to add.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    AddCollection(Stream, CultureInfo, out IEnumerable<FontDescription>)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(Stream stream, CultureInfo culture, out IEnumerable<FontDescription> descriptions)
    Parameters
    Type Name Description
    Stream stream

    The font stream.

    CultureInfo culture

    The culture of the fonts to add.

    IEnumerable<FontDescription> descriptions

    The descriptions of the added fonts.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    AddCollection(string)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(string path)
    Parameters
    Type Name Description
    string path

    The font collection path.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    AddCollection(string, out IEnumerable<FontDescription>)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(string path, out IEnumerable<FontDescription> descriptions)
    Parameters
    Type Name Description
    string path

    The font collection path.

    IEnumerable<FontDescription> descriptions

    The descriptions of the added fonts.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    AddCollection(string, CultureInfo)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(string path, CultureInfo culture)
    Parameters
    Type Name Description
    string path

    The font collection path.

    CultureInfo culture

    The culture of the fonts to add.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    AddCollection(string, CultureInfo, out IEnumerable<FontDescription>)

    Adds a true type font collection (.ttc).

    Declaration
    public IEnumerable<FontFamily> AddCollection(string path, CultureInfo culture, out IEnumerable<FontDescription> descriptions)
    Parameters
    Type Name Description
    string path

    The font collection path.

    CultureInfo culture

    The culture of the fonts to add.

    IEnumerable<FontDescription> descriptions

    The descriptions of the added fonts.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The new IEnumerable<T>.

    | Edit this page View Source

    Get(string)

    Gets the specified font family matching the invariant culture and font family name.

    Declaration
    public FontFamily Get(string name)
    Parameters
    Type Name Description
    string name

    The font family name.

    Returns
    Type Description
    FontFamily

    The first FontFamily matching the given name.

    Exceptions
    Type Condition
    ArgumentNullException

    name is null

    FontFamilyNotFoundException

    The collection contains no matches.

    | Edit this page View Source

    Get(string, CultureInfo)

    Gets the specified font family matching the given culture and font family name.

    Declaration
    public FontFamily Get(string name, CultureInfo culture)
    Parameters
    Type Name Description
    string name

    The font family name.

    CultureInfo culture

    The culture to use when searching for a match.

    Returns
    Type Description
    FontFamily

    The first FontFamily matching the given name.

    Exceptions
    Type Condition
    ArgumentNullException

    name is null

    FontFamilyNotFoundException

    The collection contains no matches.

    | Edit this page View Source

    GetByCulture(CultureInfo)

    Gets the collection of FontFamily in this FontCollection using the given culture.

    Declaration
    public IEnumerable<FontFamily> GetByCulture(CultureInfo culture)
    Parameters
    Type Name Description
    CultureInfo culture

    The culture of the families to return.

    Returns
    Type Description
    IEnumerable<FontFamily>

    The IEnumerable<T>.

    | Edit this page View Source

    TryGet(string, out FontFamily)

    Gets the specified font family matching the invariant culture and font family name.

    Declaration
    public bool TryGet(string name, out FontFamily family)
    Parameters
    Type Name Description
    string name

    The font family name.

    FontFamily family

    When this method returns, contains the family associated with the specified name, if the name is found; otherwise, the default value for the type of the family parameter. This parameter is passed uninitialized.

    Returns
    Type Description
    bool

    true if the IReadOnlyFontCollection contains a family with the specified name; otherwise, false.

    Exceptions
    Type Condition
    ArgumentNullException

    name is null

    | Edit this page View Source

    TryGet(string, CultureInfo, out FontFamily)

    Gets the specified font family matching the given culture and font family name.

    Declaration
    public bool TryGet(string name, CultureInfo culture, out FontFamily family)
    Parameters
    Type Name Description
    string name

    The font family name.

    CultureInfo culture

    The culture to use when searching for a match.

    FontFamily family

    When this method returns, contains the family associated with the specified name, if the name is found; otherwise, the default value for the type of the family parameter. This parameter is passed uninitialized.

    Returns
    Type Description
    bool

    true if the IReadOnlyFontCollection contains a family with the specified name; otherwise, false.

    Exceptions
    Type Condition
    ArgumentNullException

    name is null

    Implements

    IFontCollection
    IReadOnlyFontCollection

    Extension Methods

    FontCollectionExtensions.AddSystemFonts(FontCollection)
    FontCollectionExtensions.AddSystemFonts(FontCollection, Predicate<FontMetrics>)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX