TextFragmentState
Overview
TextFragmentState is a class in Aspose.PDF FOSS for .NET.
Inherits from: TextState.
Fragment-level text formatting state.
This class declares 13 methods for TextFragmentState objects in .NET programs.
Available methods include: ApplyChangesFrom, IsFitRectangle, MeasureHeight, MeasureString, TextFragmentState, TextState.
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 31 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 | The fragment’s font size in points: while the fragment’s own size was never set, the one the caller set on every segment when they all agree; else the fragment’s own. |
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 fragment’s font: while the fragment’s own face was never set, the one the caller set on every segment when they all name the same face; else the fragment’s own. |
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 name of the font family used for the text; null when not set. |
TextXIndent | float | Read | On-page start X (points) of the text this state belongs to. |
TextHeight | float | Read | Text height in points: (Ascent + |
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. |
LineBoxAscentEm | double? | Read/Write | Line spacing (leading) in text space units. |
LineBoxDescentEm | double? | Read/Write | The line-box descent this caller declares, in em, as a POSITIVE distance below the baseline. |
TabTag | string | Read | String token inserted into the rendered text in place of a tab character. |
LineWidth | double | Read/Write | Stroke line width (the w operator) in effect for the run: the pen a stroking RenderingMode outlines the glyphs with. |
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() | Creates a text state with the default settings: Helvetica at 10 points. |
TextState(fontSize: double) | Creates a text state with the given font size, in points. |
TextState(fontFamily: string) | Creates a text state that uses the named font family. |
TextState(fontFamily: string, fontSize: double) | Creates a text state that uses the named font family at the given size, in points. |
TextState(fontFamily: string, bold: bool, italic: bool) | Creates a text state that uses the named font family with the given bold and italic flags; the styled face (e.g. |
TextState(foregroundColor: System.Drawing.Color) | Creates a text state with the given text (foreground) colour. |
TextState(foregroundColor: System.Drawing.Color, fontSize: double) | Creates a text state with the given text (foreground) colour and font size, in points. |
TextState(foregroundColor: System.Drawing.Color, backgroundColor: System.Drawing.Color, fontStyle: FontStyles, font: Font, fontSize: double) | Colours, style, face and size in one call. |