Class TextOptions
Provides configuration options for rendering and shaping text.
public class TextOptions
- Inheritance
-
TextOptions
- Derived
- Inherited Members
Constructors
TextOptions(Font)
Initializes a new instance of the TextOptions class.
public TextOptions(Font font)
Parameters
fontFontThe font.
TextOptions(TextOptions)
Initializes a new instance of the TextOptions class from properties copied from the given instance.
public TextOptions(TextOptions options)
Parameters
optionsTextOptionsThe options whose properties are copied into this instance.
Properties
BaselineOffset
Gets or sets an additional shift of the text away from its anchored position, in pixel units along the block flow axis. Positive values shift toward the text's over side: upward for horizontal layouts, toward the over column side for vertical layouts, and away from the line along its normal when the text follows a path.
public float BaselineOffset { get; set; }
Property Value
Remarks
The shift composes with TextBaseline and moves rendered glyphs, ink
bounds, and decorations as a unit. The logical advance is unaffected, matching the
CSS and SVG baseline-shift model.
ColorFontSupport
Gets or sets the color font support options.
public ColorFontSupport ColorFontSupport { get; set; }
Property Value
Remarks
A text run with a non-null ColorFontSupport value replaces this value over that run.
Culture
Gets or sets the culture used to select language specific glyph shaping.
public CultureInfo? Culture { get; set; }
Property Value
Remarks
Fonts can substitute and position glyphs differently per language, for example the Turkish dotless i or Serbian italic letterforms. When set, shaping selects the matching language system within each script's OpenType feature tables, falling back to the font's default language system when the font does not distinguish the language. When null the current culture applies, matching the ambient language model of the reference shaping engines; use InvariantCulture to express no language preference and always shape with the font's default language system.
CustomEllipsis
Gets or sets the ellipsis marker to use when TextEllipsis is Custom.
public CodePoint? CustomEllipsis { get; set; }
Property Value
CustomHyphen
Gets or sets the hyphenation marker to use when TextHyphenation is Custom.
public CodePoint? CustomHyphen { get; set; }
Property Value
DecorationPositioningMode
Gets or sets the positioning mode used for rendering decorations.
public DecorationPositioningMode DecorationPositioningMode { get; set; }
Property Value
Dpi
Gets or sets the DPI (Dots Per Inch) to render/measure the text at.
Defaults to 72F.
public float Dpi { get; set; }
Property Value
FallbackFontFamilies
Gets or sets the collection of fallback font families to use when a specific glyph is missing from Font.
public IReadOnlyList<FontFamily> FallbackFontFamilies { get; set; }
Property Value
FeatureTags
Gets or sets the collection of additional feature tags to apply during glyph shaping.
public IReadOnlyList<Tag> FeatureTags { get; set; }
Property Value
Remarks
A text run with a non-null FeatureTags collection replaces this collection over that run.
Font
Gets or sets the font.
public Font Font { get; set; }
Property Value
FontFallbackResolver
Gets or sets the resolver consulted for code points that neither Font nor any FallbackFontFamilies entry can shape, or null to leave such code points rendered as the missing-glyph outline.
public IFontFallbackResolver? FontFallbackResolver { get; set; }
Property Value
Remarks
Resolution happens per distinct unresolved code point after every configured font has attempted the text. FallbackResolver selects from the fonts installed on the current machine, so rendered output can differ between machines.
FontPalette
Gets or sets the color palette selection used to resolve COLR glyph colors, or null to use the font's default palette.
public FontPalette? FontPalette { get; set; }
Property Value
Remarks
A text run with a non-null FontPalette value replaces this value over that run.
FontWeight
public FontWeight? FontWeight { get; set; }
Property Value
HintingMode
Gets or sets a value indicating whether to apply hinting - The use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid.
public HintingMode HintingMode { get; set; }
Property Value
HorizontalAlignment
Gets or sets the horizontal alignment of the text box.
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
KerningMode
Gets or sets the kerning mode indicating whether to apply kerning (character spacing adjustments) to the glyph positions from information found within the font.
public KerningMode KerningMode { get; set; }
Property Value
LayoutMode
Gets or sets the layout mode for the text lines.
public LayoutMode LayoutMode { get; set; }
Property Value
LineSpacing
Gets or sets the line spacing. Applied as a multiple of the line height.
Defaults to 1F.
public float LineSpacing { get; set; }
Property Value
MaxLines
Gets or sets the maximum number of lines to lay out.
public int MaxLines { get; set; }
Property Value
Remarks
If value is -1 then the number of lines is unlimited.
Origin
Gets or sets the rendering origin.
public Vector2 Origin { get; set; }
Property Value
Script
Gets or sets the script applied to the whole shaping request, or null when script runs are inferred from the text.
public ScriptClass? Script { get; set; }
Property Value
TabWidth
Gets or sets the width of the tab. Measured as the distance in spaces (U+0020).
public float TabWidth { get; set; }
Property Value
Remarks
If value is -1 then the font default tab width is used.
TextAlignment
Gets or sets the text alignment of the text within the box.
public TextAlignment TextAlignment { get; set; }
Property Value
TextBaseline
Gets or sets which reference line of the first laid-out line is placed at Origin along the block flow axis.
public TextBaseline TextBaseline { get; set; }
Property Value
Remarks
Baseline positions derive from the metrics of Font: horizontal layouts anchor along Y from the alphabetic baseline, vertical layouts along X from the central column axis. When the value is not LineBox the block alignment along the flow axis does not apply; additional wrapped lines stack relative to the anchored first line.
TextBidiMode
Gets or sets how bidirectional text is resolved.
public TextBidiMode TextBidiMode { get; set; }
Property Value
TextDecorationSkipInk
Gets or sets a value indicating whether underline and overline decorations skip over glyph ink, leaving gaps around descenders and ascenders that cross the decoration. Defaults to Auto.
public TextDecorationSkipInk TextDecorationSkipInk { get; set; }
Property Value
TextDirection
Gets or sets the text direction.
public TextDirection TextDirection { get; set; }
Property Value
TextEllipsis
Gets or sets the ellipsis behavior to use when laid-out text is limited to a maximum number of lines.
public TextEllipsis TextEllipsis { get; set; }
Property Value
TextHyphenation
Gets or sets the hyphenation marker behavior to use when text breaks at hyphenation opportunities.
public TextHyphenation TextHyphenation { get; set; }
Property Value
TextInteractionMode
Gets or sets how caret movement and selection model trailing breaking whitespace.
public TextInteractionMode TextInteractionMode { get; set; }
Property Value
TextJustification
Gets or sets the justification of the text within the box.
public TextJustification TextJustification { get; set; }
Property Value
TextRuns
Gets or sets an optional collection of text runs to apply to the body of text.
public IReadOnlyList<TextRun> TextRuns { get; set; }
Property Value
Tracking
Gets or sets the tracking (letter-spacing) value. Tracking adjusts the spacing between all characters uniformly and is measured in em. Positive values increase spacing, negative values decrease spacing, and zero applies no adjustment.
public float Tracking { get; set; }
Property Value
VerticalAlignment
Gets or sets the vertical alignment of the text box.
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
VisibleBounds
Gets or sets the visible region in pixel units (px) used when rendering text. Whole lines that fall outside the region are skipped and the remaining lines are positioned as if all lines had been rendered.
public FontRectangle? VisibleBounds { get; set; }
Property Value
Remarks
If value is null then culling is disabled.
WordBreaking
Gets or sets the word breaking mode to use when wrapping text.
public WordBreaking WordBreaking { get; set; }
Property Value
WrappingLength
Gets or sets the length in pixel units (px) at which text will automatically wrap onto a new line. This property also affects the width or height (depending on the LayoutMode) of the text box for alignment of text.
public float WrappingLength { get; set; }
Property Value
Remarks
If value is -1 then wrapping is disabled.