Class TextMeasurer
Encapulated logic for laying out and measuring text.
Inherited Members
Namespace: SixLabors.Fonts
Assembly: SixLabors.Fonts.dll
Syntax
public static class TextMeasurer
Methods
| Improve this Doc View SourceMeasure(ReadOnlySpan<Char>, RendererOptions)
Measures the text.
Declaration
public static FontRectangle Measure(ReadOnlySpan<char> text, RendererOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | text | The text. |
| RendererOptions | options | The style. |
Returns
| Type | Description |
|---|---|
| FontRectangle | The size of the text if it was to be rendered. |
Measure(String, RendererOptions)
Measures the text.
Declaration
public static FontRectangle Measure(string text, RendererOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| String | text | The text. |
| RendererOptions | options | The style. |
Returns
| Type | Description |
|---|---|
| FontRectangle | The size of the text if it was to be rendered. |
MeasureBounds(ReadOnlySpan<Char>, RendererOptions)
Measures the text.
Declaration
public static FontRectangle MeasureBounds(ReadOnlySpan<char> text, RendererOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | text | The text. |
| RendererOptions | options | The style. |
Returns
| Type | Description |
|---|---|
| FontRectangle | The size of the text if it was to be rendered. |
MeasureBounds(String, RendererOptions)
Measures the text.
Declaration
public static FontRectangle MeasureBounds(string text, RendererOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| String | text | The text. |
| RendererOptions | options | The style. |
Returns
| Type | Description |
|---|---|
| FontRectangle | The size of the text if it was to be rendered. |
TryMeasureCharacterBounds(ReadOnlySpan<Char>, RendererOptions, out GlyphMetric[])
Measures the character bounds of the text. For each control character the list contains a null element.
Declaration
public static bool TryMeasureCharacterBounds(ReadOnlySpan<char> text, RendererOptions options, out GlyphMetric[] characterBounds)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | text | The text. |
| RendererOptions | options | The style. |
| GlyphMetric[] | 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. |