TextFragmentState

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

NameTypeAccessDescription
BackgroundColorColor?Read/WriteBackground fill applied behind the fragment text.
CharacterSpacingfloatRead/WriteCharacter spacing (Tc) in text-space units.
CoordinateOriginCoordinateOriginRead/WriteWhether positioning treats Y as the baseline or the descender.
FontSizefloatRead/WriteFont size in points.
FontStyleFontStylesRead/WriteFont style flags (Bold / Italic).
ForegroundColorColor?Read/WriteFill (non-stroking) colour applied to the rendered glyphs.
FormattingOptionsTextFormattingOptionsRead/WriteText formatting options (wrap mode, line spacing mode, etc.).
HorizontalAlignmentHorizontalAlignmentRead/WriteHorizontal alignment of the fragment’s text.
HorizontalScalingfloatRead/WriteHorizontal scaling percentage (default 100).
InvisibleboolRead/WriteWhether the text is rendered invisibly (rendering mode 3).
LineSpacingfloatRead/WriteLine spacing (leading) in text-space units.
RenderingModeTextRenderingModeRead/WriteGlyph rendering mode (fill / stroke / clip).
RotationdoubleRead/WriteRotation angle in degrees.
StrikeOutboolRead/WriteWhether the text has strikethrough.
StrokingColorColor?Read/WriteStroke (outline) colour.
SubscriptboolRead/WriteWhether the text is subscript.
SuperscriptboolRead/WriteWhether the text is superscript.
UnderlineboolRead/WriteWhether the text is underlined.
WordSpacingfloatRead/WriteWord spacing (Tw) in text-space units.
FontAspose.Pdf.Text.Font?Read/WriteThe font used to render the fragment.
DrawTextRectangleBorderboolRead/WriteWhen true, a rectangular border is drawn around the text bounding box.
TabStopsTabStopsReadTab-stop settings inherited from the owning fragment.
FontNamestring?Read/WriteGets or sets the font name.
TextHeightfloatReadApproximate 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).
IsBoldboolRead/WriteWhether the font is bold.
IsItalicboolRead/WriteWhether the font is italic.
IsUnderlineboolRead/WriteWhether the text is underlined.
IsStrikeOutboolRead/WriteWhether the text has strikethrough.
IsSuperscriptboolRead/WriteWhether the text is superscript.
IsSubscriptboolRead/WriteWhether the text is subscript.
TabTagstringReadString token inserted into the rendered text in place of a tab character.
TextRisedoubleRead/WriteText rise (superscript/subscript offset).
FontDataFontData?Read/WriteExternal font data for embedding (set via FontRepository.OpenFont).

Methods

SignatureDescription
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.

See Also