TextState

Overview

TextState is a class in Aspose.PDF FOSS for .NET.

Text formatting state.

This class declares 11 methods for TextState objects in .NET programs. Available methods include: ApplyChangesFrom, MeasureHeight, MeasureString, TextState. Public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package. Properties: BackgroundColor, CharacterSpacing, CoordinateOrigin, Font, FontData, FontName, and 29 more.

Properties

NameTypeAccessDescription
FontNamestring?Read/WriteGets or sets the name of the font family used for the text; null when not set.
TextXIndentfloatReadOn-page start X (points) of the text this state belongs to.
TextHeightfloatReadText height in points: (Ascent +
FontSizefloatRead/WriteGets or sets the font size, in points; the default is 10.
ForegroundColorColor?Read/WriteGets or sets the text fill colour; null when not set.
StrokingColorColor?Read/WriteStroking (outline) color of the text.
CoordinateOriginCoordinateOriginRead/WriteWhether text positioning treats Y as the baseline or the descender.
BackgroundColorColor?Read/WriteGets or sets the colour of a rectangle painted behind the text; null (the default) paints none.
IsBoldboolRead/WriteWhether the font is bold.
IsItalicboolRead/WriteWhether the font is italic.
FontStyleFontStylesRead/WriteFont style flags (Bold, Italic, etc.).
UnderlineboolRead/WriteWhether the text is underlined (alias for IsUnderline).
IsUnderlineboolRead/WriteWhether the text is underlined.
IsStrikeOutboolRead/WriteWhether the text has strikethrough.
StrikeOutboolRead/WriteAlias for IsStrikeOut.
IsSuperscriptboolRead/WriteWhether the text is superscript.
SuperscriptboolRead/WriteAlias for IsSuperscript.
IsSubscriptboolRead/WriteWhether the text is subscript.
SubscriptboolRead/WriteAlias for IsSubscript.
CharacterSpacingfloatRead/WriteCharacter spacing in text space units.
WordSpacingfloatRead/WriteWord spacing in text space units.
HorizontalScalingfloatRead/WriteHorizontal scaling percentage (default 100).
LineBoxAscentEmdouble?Read/WriteLine spacing (leading) in text space units.
LineBoxDescentEmdouble?Read/WriteThe line-box descent this caller declares, in em, as a POSITIVE distance below the baseline.
LineSpacingfloatRead/WriteGets or sets the extra space, in points, added above each line of the text; the default is 0.
TabTagstringReadString token inserted into the rendered text in place of a tab character.
HorizontalAlignmentHorizontalAlignmentRead/WriteHorizontal alignment of the text.
RenderingModeTextRenderingModeRead/WriteText rendering mode (Tr operator).
LineWidthdoubleRead/WriteStroke line width (the w operator) in effect for the run: the pen a stroking RenderingMode outlines the glyphs with.
InvisibleboolRead/WriteWhether this text fragment is invisible: rendering mode 3, or text that a LATER opaque filled rectangle fully covers (hidden-by-occlusion: redaction-style covered text reports Invisible while its RenderingMode stays FillText).
TextRisedoubleRead/WriteText rise (superscript/subscript offset).
RotationdoubleRead/WriteText rotation angle in degrees.
FontFont?Read/WriteGets or sets the font used for the text; the default is Helvetica.
FontDataFontData?Read/WriteExternal font data for embedding (set via FontRepository.OpenFont).
FormattingOptionsTextFormattingOptionsRead/WriteText formatting options (WordWrapMode, LineSpacingMode, etc.).

Methods

SignatureDescription
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.
MeasureString(str: string)Rough text-width estimate at the current font/size.
MeasureHeight(character: char)Height of character at the current font / size, in points — the glyph’s own bounding-box height (yMax − yMin) mapped to text space as height × FontSize / 1000.
ApplyChangesFrom(textState: TextState)Copy every public formatting property from other into this state (leaving owner linkage intact).

See Also

 English