Class TextMeasurer
Encapsulated logic for laying out and then measuring text properties.
Inherited Members
Namespace: SixLabors.Fonts
Assembly: SixLabors.Fonts.dll
Syntax
public static class TextMeasurerMethods
| Improve this Doc View SourceCountLines(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 | 
|---|---|
| Int32 | The line count. | 
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 | 
|---|---|
| Int32 | The line count. | 
Measure(ReadOnlySpan<Char>, TextOptions)
Measures the size of the text in pixel units.
Declaration
public static FontRectangle Measure(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. | 
Measure(String, TextOptions)
Measures the size of the text in pixel units.
Declaration
public static FontRectangle Measure(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. | 
MeasureBounds(ReadOnlySpan<Char>, TextOptions)
Measures the text bounds in 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 size of the text if it was to be rendered. | 
MeasureBounds(String, TextOptions)
Measures the text bounds in 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 size of the text if it was to be rendered. | 
TryMeasureCharacterBounds(ReadOnlySpan<Char>, TextOptions, out GlyphBounds[])
Measures the character bounds of the text in pixel units.
Declaration
public static bool TryMeasureCharacterBounds(ReadOnlySpan<char> text, TextOptions options, out GlyphBounds[] characterBounds)Parameters
| Type | Name | Description | 
|---|---|---|
| ReadOnlySpan<Char> | text | The text. | 
| TextOptions | options | The text shaping options. | 
| GlyphBounds[] | characterBounds | The list of character bounds of the text if it was to be rendered. | 
Returns
| Type | Description | 
|---|---|
| Boolean | Whether any of the characters had non-empty bounds. | 
TryMeasureCharacterBounds(String, TextOptions, out GlyphBounds[])
Measures the character bounds of the text in pixel units.
Declaration
public static bool TryMeasureCharacterBounds(string text, TextOptions options, out GlyphBounds[] characterBounds)Parameters
| Type | Name | Description | 
|---|---|---|
| String | text | The text. | 
| TextOptions | options | The text shaping options. | 
| GlyphBounds[] | characterBounds | The list of character bounds of the text if it was to be rendered. | 
Returns
| Type | Description | 
|---|---|
| Boolean | Whether any of the characters had non-empty bounds. | 
TryMeasureCharacterDimensions(ReadOnlySpan<Char>, TextOptions, out GlyphBounds[])
Measures the size of each character of the text in pixel units.
Declaration
public static bool TryMeasureCharacterDimensions(ReadOnlySpan<char> text, TextOptions options, out GlyphBounds[] characterBounds)Parameters
| Type | Name | Description | 
|---|---|---|
| ReadOnlySpan<Char> | text | The text. | 
| TextOptions | options | The text shaping options. | 
| GlyphBounds[] | characterBounds | The list of character dimensions of the text if it was to be rendered. | 
Returns
| Type | Description | 
|---|---|
| Boolean | Whether any of the characters had non-empty dimensions. | 
TryMeasureCharacterDimensions(String, TextOptions, out GlyphBounds[])
Measures the size of each character of the text in pixel units.
Declaration
public static bool TryMeasureCharacterDimensions(string text, TextOptions options, out GlyphBounds[] characterBounds)Parameters
| Type | Name | Description | 
|---|---|---|
| String | text | The text. | 
| TextOptions | options | The text shaping options. | 
| GlyphBounds[] | characterBounds | The list of character dimensions of the text if it was to be rendered. | 
Returns
| Type | Description | 
|---|---|
| Boolean | Whether any of the characters had non-empty dimensions. |