TextFragmentState
Overview
TextFragmentState is a class in Aspose.PDF FOSS for .NET.
Inherits from: TextState.
Fragment-level text formatting state.
This class provides 6 methods for working with TextFragmentState objects in .NET programs.
Available methods include: ApplyChangesFrom, IsFitRectangle, MeasureHeight, MeasureString, TextFragmentState, TextState.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: BackgroundColor, CharacterSpacing, CoordinateOrigin, DrawTextRectangleBorder, Font, FontData, and 27 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
BackgroundColor | Color? | Read/Write | Background fill applied behind the fragment text. |
CharacterSpacing | float | Read/Write | Character spacing (Tc) in text-space units. |
CoordinateOrigin | CoordinateOrigin | Read/Write | Whether positioning treats Y as the baseline or the descender. |
FontSize | float | Read/Write | Font size in points. |
FontStyle | FontStyles | Read/Write | Font style flags (Bold / Italic). |
ForegroundColor | Color? | Read/Write | Fill (non-stroking) colour applied to the rendered glyphs. |
FormattingOptions | TextFormattingOptions | Read/Write | Text formatting options (wrap mode, line spacing mode, etc.). |
HorizontalAlignment | HorizontalAlignment | Read/Write | Horizontal alignment of the fragment’s text. |
HorizontalScaling | float | Read/Write | Horizontal scaling percentage (default 100). |
Invisible | bool | Read/Write | Whether the text is rendered invisibly (rendering mode 3). |
LineSpacing | float | Read/Write | Line spacing (leading) in text-space units. |
RenderingMode | TextRenderingMode | Read/Write | Glyph rendering mode (fill / stroke / clip). |
Rotation | double | Read/Write | Rotation angle in degrees. |
StrikeOut | bool | Read/Write | Whether the text has strikethrough. |
StrokingColor | Color? | Read/Write | Stroke (outline) colour. |
Subscript | bool | Read/Write | Whether the text is subscript. |
Superscript | bool | Read/Write | Whether the text is superscript. |
Underline | bool | Read/Write | Whether the text is underlined. |
WordSpacing | float | Read/Write | Word spacing (Tw) in text-space units. |
Font | Aspose.Pdf.Text.Font? | Read/Write | The font used to render the fragment. |
DrawTextRectangleBorder | bool | Read/Write | When true, a rectangular border is drawn around the text bounding box. |
TabStops | TabStops | Read | Tab-stop settings inherited from the owning fragment. |
FontName | string? | Read/Write | Gets or sets the font name. |
TextHeight | float | Read | Approximate text height in points; approximates the glyph-bounding-box-derived height by returning the font size (typical ratio between FontSize and rendered text height is close enough for the layout math callers use this for). |
IsBold | bool | Read/Write | Whether the font is bold. |
IsItalic | bool | Read/Write | Whether the font is italic. |
IsUnderline | bool | Read/Write | Whether the text is underlined. |
IsStrikeOut | bool | Read/Write | Whether the text has strikethrough. |
IsSuperscript | bool | Read/Write | Whether the text is superscript. |
IsSubscript | bool | Read/Write | Whether the text is subscript. |
TabTag | string | Read | String token inserted into the rendered text in place of a tab character. |
TextRise | double | Read/Write | Text rise (superscript/subscript offset). |
FontData | FontData? | Read/Write | External font data for embedding (set via FontRepository.OpenFont). |
Methods
| Signature | Description |
|---|---|
TextFragmentState(fragment: TextFragment) | Wrap the fragment’s underlying state so writes flow back to it. |
ApplyChangesFrom(textState: TextState) | Copy every public formatting property from textState into this state. |
IsFitRectangle(str: string, rect: Rectangle) | Returns true when the rendered text fits within the supplied rectangle at the current font / size. |
MeasureHeight(character: char) | Measure the height of a single character at the current font / size, in points. |
MeasureString(str: string) | Measure the rendered width of str at the current font / size, in points. |
TextState() | Calls TextState on this TextFragmentState instance. |