• 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 TextMeasurer

    Encapsulated logic for laying out and then measuring text properties.

    Inheritance
    object
    TextMeasurer
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: SixLabors.Fonts
    Assembly: SixLabors.Fonts.dll
    Syntax
    public static class TextMeasurer

    Methods

    | Edit this page View Source

    CountLines(ReadOnlySpan<char>, TextOptions)

    Gets the number of lines contained within the text.

    Declaration
    public static int CountLines(ReadOnlySpan<char> text, TextOptions options)
    Parameters
    Type Name Description
    ReadOnlySpan<char> text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    int

    The line count.

    | Edit this page View Source

    CountLines(string, TextOptions)

    Gets the number of lines contained within the text.

    Declaration
    public static int CountLines(string text, TextOptions options)
    Parameters
    Type Name Description
    string text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    int

    The line count.

    | Edit this page View Source

    MeasureAdvance(ReadOnlySpan<char>, TextOptions)

    Measures the advance (line-height and horizontal/vertical advance) of the text in pixel units.

    Declaration
    public static FontRectangle MeasureAdvance(ReadOnlySpan<char> text, TextOptions options)
    Parameters
    Type Name Description
    ReadOnlySpan<char> text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    FontRectangle

    The advance of the text if it was to be rendered.

    | Edit this page View Source

    MeasureAdvance(string, TextOptions)

    Measures the advance (line-height and horizontal/vertical advance) of the text in pixel units.

    Declaration
    public static FontRectangle MeasureAdvance(string text, TextOptions options)
    Parameters
    Type Name Description
    string text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    FontRectangle

    The advance of the text if it was to be rendered.

    | Edit this page View Source

    MeasureBounds(ReadOnlySpan<char>, TextOptions)

    Measures the text bounds in sub-pixel units.

    Declaration
    public static FontRectangle MeasureBounds(ReadOnlySpan<char> text, TextOptions options)
    Parameters
    Type Name Description
    ReadOnlySpan<char> text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    FontRectangle

    The bounds of the text if it was to be rendered.

    | Edit this page View Source

    MeasureBounds(string, TextOptions)

    Measures the text bounds in sub-pixel units.

    Declaration
    public static FontRectangle MeasureBounds(string text, TextOptions options)
    Parameters
    Type Name Description
    string text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    FontRectangle

    The bounds of the text if it was to be rendered.

    | Edit this page View Source

    MeasureSize(ReadOnlySpan<char>, TextOptions)

    Measures the minimum size required, in pixel units, to render the text.

    Declaration
    public static FontRectangle MeasureSize(ReadOnlySpan<char> text, TextOptions options)
    Parameters
    Type Name Description
    ReadOnlySpan<char> text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    FontRectangle

    The size of the text if it was to be rendered.

    | Edit this page View Source

    MeasureSize(string, TextOptions)

    Measures the minimum size required, in pixel units, to render the text.

    Declaration
    public static FontRectangle MeasureSize(string text, TextOptions options)
    Parameters
    Type Name Description
    string text

    The text.

    TextOptions options

    The text shaping options.

    Returns
    Type Description
    FontRectangle

    The size of the text if it was to be rendered.

    | Edit this page View Source

    TryMeasureCharacterAdvances(ReadOnlySpan<char>, TextOptions, out ReadOnlySpan<GlyphBounds>)

    Measures the advance (line-height and horizontal/vertical advance) of each character of the text in pixel units.

    Declaration
    public static bool TryMeasureCharacterAdvances(ReadOnlySpan<char> text, TextOptions options, out ReadOnlySpan<GlyphBounds> advances)
    Parameters
    Type Name Description
    ReadOnlySpan<char> text

    The text.

    TextOptions options

    The text shaping options.

    ReadOnlySpan<GlyphBounds> advances

    The list of character advances of the text if it was to be rendered.

    Returns
    Type Description
    bool

    Whether any of the characters had non-empty advances.

    | Edit this page View Source

    TryMeasureCharacterAdvances(string, TextOptions, out ReadOnlySpan<GlyphBounds>)

    Measures the advance (line-height and horizontal/vertical advance) of each character of the text in pixel units.

    Declaration
    public static bool TryMeasureCharacterAdvances(string text, TextOptions options, out ReadOnlySpan<GlyphBounds> advances)
    Parameters
    Type Name Description
    string text

    The text.

    TextOptions options

    The text shaping options.

    ReadOnlySpan<GlyphBounds> advances

    The list of character advances of the text if it was to be rendered.

    Returns
    Type Description
    bool

    Whether any of the characters had non-empty advances.

    | Edit this page View Source

    TryMeasureCharacterBounds(ReadOnlySpan<char>, TextOptions, out ReadOnlySpan<GlyphBounds>)

    Measures the character bounds of the text in sub-pixel units.

    Declaration
    public static bool TryMeasureCharacterBounds(ReadOnlySpan<char> text, TextOptions options, out ReadOnlySpan<GlyphBounds> bounds)
    Parameters
    Type Name Description
    ReadOnlySpan<char> text

    The text.

    TextOptions options

    The text shaping options.

    ReadOnlySpan<GlyphBounds> bounds

    The list of character bounds of the text if it was to be rendered.

    Returns
    Type Description
    bool

    Whether any of the characters had non-empty bounds.

    | Edit this page View Source

    TryMeasureCharacterBounds(string, TextOptions, out ReadOnlySpan<GlyphBounds>)

    Measures the character bounds of the text in sub-pixel units.

    Declaration
    public static bool TryMeasureCharacterBounds(string text, TextOptions options, out ReadOnlySpan<GlyphBounds> bounds)
    Parameters
    Type Name Description
    string text

    The text.

    TextOptions options

    The text shaping options.

    ReadOnlySpan<GlyphBounds> bounds

    The list of character bounds of the text if it was to be rendered.

    Returns
    Type Description
    bool

    Whether any of the characters had non-empty bounds.

    | Edit this page View Source

    TryMeasureCharacterSizes(ReadOnlySpan<char>, TextOptions, out ReadOnlySpan<GlyphBounds>)

    Measures the minimum size required, in pixel units, to render each character in the text.

    Declaration
    public static bool TryMeasureCharacterSizes(ReadOnlySpan<char> text, TextOptions options, out ReadOnlySpan<GlyphBounds> sizes)
    Parameters
    Type Name Description
    ReadOnlySpan<char> text

    The text.

    TextOptions options

    The text shaping options.

    ReadOnlySpan<GlyphBounds> sizes

    The list of character dimensions of the text if it was to be rendered.

    Returns
    Type Description
    bool

    Whether any of the characters had non-empty dimensions.

    | Edit this page View Source

    TryMeasureCharacterSizes(string, TextOptions, out ReadOnlySpan<GlyphBounds>)

    Measures the minimum size required, in pixel units, to render each character in the text.

    Declaration
    public static bool TryMeasureCharacterSizes(string text, TextOptions options, out ReadOnlySpan<GlyphBounds> sizes)
    Parameters
    Type Name Description
    string text

    The text.

    TextOptions options

    The text shaping options.

    ReadOnlySpan<GlyphBounds> sizes

    The list of character dimensions of the text if it was to be rendered.

    Returns
    Type Description
    bool

    Whether any of the characters had non-empty dimensions.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX