Class TextMeasurer
Encapsulates logic for laying out and then measuring text properties.
public static class TextMeasurer
- Inheritance
-
TextMeasurer
- Inherited Members
Methods
CountLines(ReadOnlySpan<char>, TextOptions)
Gets the number of laid-out lines contained within the text.
public static int CountLines(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- int
The laid-out line count.
CountLines(string, TextOptions)
Gets the number of laid-out lines contained within the text.
public static int CountLines(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- int
The laid-out line count.
GetGlyphMetrics(ReadOnlySpan<char>, TextOptions)
Gets the positioned metrics of each laid-out glyph entry in pixel units.
public static ReadOnlyMemory<GlyphMetrics> GetGlyphMetrics(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<GlyphMetrics>
A read-only memory region containing the per-glyph metrics entries of the text if it was to be rendered.
GetGlyphMetrics(string, TextOptions)
Gets the positioned metrics of each laid-out glyph entry in pixel units.
public static ReadOnlyMemory<GlyphMetrics> GetGlyphMetrics(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<GlyphMetrics>
A read-only memory region containing the per-glyph metrics entries of the text if it was to be rendered.
GetGraphemeMetrics(ReadOnlySpan<char>, TextOptions)
Gets the positioned metrics of each laid-out grapheme in pixel units.
public static ReadOnlyMemory<GraphemeMetrics> GetGraphemeMetrics(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<GraphemeMetrics>
A read-only memory region containing the per-grapheme metrics entries of the text if it was to be rendered.
GetGraphemeMetrics(string, TextOptions)
Gets the positioned metrics of each laid-out grapheme in pixel units.
public static ReadOnlyMemory<GraphemeMetrics> GetGraphemeMetrics(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<GraphemeMetrics>
A read-only memory region containing the per-grapheme metrics entries of the text if it was to be rendered.
GetLineMetrics(ReadOnlySpan<char>, TextOptions)
Gets per-line layout metrics for the supplied text.
public static ReadOnlyMemory<LineMetrics> GetLineMetrics(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text to measure.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<LineMetrics>
A read-only memory region containing LineMetrics in pixel units, one entry per laid-out line.
GetLineMetrics(string, TextOptions)
Gets per-line layout metrics for the supplied text.
public static ReadOnlyMemory<LineMetrics> GetLineMetrics(string text, TextOptions options)
Parameters
textstringThe text to measure.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<LineMetrics>
A read-only memory region containing LineMetrics in pixel units, one entry per laid-out line.
GetWordMetrics(ReadOnlySpan<char>, TextOptions)
Gets the positioned metrics of each Unicode word-boundary segment in pixel units.
public static ReadOnlyMemory<WordMetrics> GetWordMetrics(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<WordMetrics>
A read-only memory region containing the per-word-boundary segment metrics entries of the text if it was to be rendered.
GetWordMetrics(string, TextOptions)
Gets the positioned metrics of each Unicode word-boundary segment in pixel units.
public static ReadOnlyMemory<WordMetrics> GetWordMetrics(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- ReadOnlyMemory<WordMetrics>
A read-only memory region containing the per-word-boundary segment metrics entries of the text if it was to be rendered.
Measure(ReadOnlySpan<char>, TextOptions)
Measures the full set of layout metrics for the supplied text in a single pass.
public static TextMetrics Measure(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- TextMetrics
A TextMetrics instance containing every measurement for the laid-out text.
Measure(string, TextOptions)
Measures the full set of layout metrics for the supplied text in a single pass.
public static TextMetrics Measure(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- TextMetrics
A TextMetrics instance containing every measurement for the laid-out text.
MeasureAdvance(ReadOnlySpan<char>, TextOptions)
Measures the logical advance of the text in pixel units.
public static FontRectangle MeasureAdvance(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- FontRectangle
The logical advance rectangle of the text if it was to be rendered.
MeasureAdvance(string, TextOptions)
Measures the logical advance of the text in pixel units.
public static FontRectangle MeasureAdvance(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- FontRectangle
The logical advance rectangle of the text if it was to be rendered.
MeasureBounds(ReadOnlySpan<char>, TextOptions)
Measures the rendered glyph bounds of the text in pixel units.
public static FontRectangle MeasureBounds(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- FontRectangle
The rendered glyph bounds of the text if it was to be rendered.
MeasureBounds(string, TextOptions)
Measures the rendered glyph bounds of the text in pixel units.
public static FontRectangle MeasureBounds(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- FontRectangle
The rendered glyph bounds of the text if it was to be rendered.
MeasureRenderableBounds(ReadOnlySpan<char>, TextOptions)
Measures the full renderable bounds of the text in pixel units.
public static FontRectangle MeasureRenderableBounds(ReadOnlySpan<char> text, TextOptions options)
Parameters
textReadOnlySpan<char>The text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- FontRectangle
The union of the logical advance rectangle and the rendered glyph bounds if the text was to be rendered.
MeasureRenderableBounds(string, TextOptions)
Measures the full renderable bounds of the text in pixel units.
public static FontRectangle MeasureRenderableBounds(string text, TextOptions options)
Parameters
textstringThe text.
optionsTextOptionsThe text options. WrappingLength controls wrapping; use
-1to disable wrapping.
Returns
- FontRectangle
The union of the logical advance rectangle and the rendered glyph bounds if the text was to be rendered.