TextState

Inheritance: java.lang.Object, com.aspose.pdf.TextState

public class TextState extends Object

Represents a text state of a text

Fields

FieldDescription
TabstopDefaultValueDefault value of tabulation in widths of space character of default font.

Constructors

ConstructorDescription
TextStateCreates text state object.
TextStateCreates text state object.
TextStateCreates text state object.
TextStateCreates text state object with font size specification.
TextStateCreates text state object.
TextStateCreates text state object.
TextStateCreates text state object.

Methods

MethodDescription
applyChangesFrom

Applies settings from another textState


Only those properties will be copied that were changed explicitly.

calculateFontSizeCalculates the font size for the rectangle.
getBackgroundColor

Gets background color of the text.


Note that the value is not preserved as a text characteristic within the document. The BackgroundColor property getter works for an object in case it was explicitly set previously with BackgroundColor setter for those object. The property is used by runtime in context of current generation/modification process.

getCharacterSpacingGets character spacing of the text.
getCoordinateOriginGets or sets text CoordinateOrigin. If CoordinateOrigin is Descender, the text Y coordinate corresponds to the font’s lowest point. If CoordinateOrigin is BaseLine, the text Y coordinate corresponds to the font’s baseline. The default value is Descender. If the font’s Descent value is too big, text can be rendered higher than other fonts. In this case, CoordinateOrigin BaseLine can be selected for better text rendering.
getFontGets font of the text.
getfontSizeRepresent getfontSize method
getFontSizeGets font size of the text.
getFontStyleSets font style of the text.
getForegroundColorGets foreground color of the text.
getHorizontalAlignment

Gets horizontal alignment for the text.


HorizontalAlignment.None is equal to HorizontalAlignment.Left. Note that TextState.HorizontalAlignment property works in new document generation scenarios only.

getHorizontalScalingGets horizontal scaling of the text.
getLineSpacing

Gets line spacing of the text.

getRenderingModeGets or sets rendering mode of text.
getStrokingColorGets or sets foreground color of the text.
getTabTag

You can place this tag in text to declare tabulation.


It has effect only in couple with {@code TabStops}.

getTextHeightGets text height.
getWordSpacingGets word spacing of the text.
isInvisibleGets the invisibility of text. This basically reflects the {@code RenderingMode}({@link #getRenderingMode}/{@code #setRenderingMode(TextRenderingMode)}) state, except for some special cases (like clipping).
isStrikeOutGets strikeout for the text, represented by the {@code TextFragment} object
isSubscriptGets or sets subscript of the text.
isSuperscriptGets superscript of the text.
isUnderlineGets underline for the text, represented by the {@code TextFragment} object
measureHeightMeasures character height.
measureStringMeasures the string.
measureString

Measures the string.


insideLine indicate that the string is not ending. in case part of the whole string is measured - the insideLine should be true. in case the whole string is measured the insideLine should be false. in other words: in case insideLine = true only character widths are taken into account. no additional transformations are taken into account in case insideLine = false end of the string is handled properly - italic transformation is taken into account.

setBackgroundColorSets background color of the text.
setCharacterSpacingSets character spacing of the text.
setCoordinateOriginGets or sets text CoordinateOrigin. If CoordinateOrigin is Descender, the text Y coordinate corresponds to the font’s lowest point. If CoordinateOrigin is BaseLine, the text Y coordinate corresponds to the font’s baseline. The default value is Descender. If the font’s Descent value is too big, text can be rendered higher than other fonts. In this case, CoordinateOrigin BaseLine can be selected for better text rendering.
setFontGets font of the text.
setFontSizeSets font size of the text.
setFontSizeSuppressedUpdateSets font size of the text wish suppressed update.
setFontStyleSets font style of the text.
setFontSuppressedUpdateGets font of the text wish suppressed update.
setForegroundColorSets foreground color of the text.
setHorizontalAlignment

Sets horizontal alignment for the text.


HorizontalAlignment.None is equal to HorizontalAlignment.Left. Note that TextState.HorizontalAlignment property works in new document generation scenarios only.

setHorizontalScalingSets horizontal scaling of the text.
setInvisibleSets the invisibility of text. This basically reflects the {@code RenderingMode}({@link #getRenderingMode}/{@code #setRenderingMode(TextRenderingMode)}) state, except for some special cases (like clipping).
setLineSpacing

Sets line spacing of the text.

setRenderingModeGets or sets rendering mode of text.
setStrikeOutSets strikeout for the text, represented by the {@code TextFragment} object
setStrokingColorGets or sets foreground color of the text.
setSubscriptGets or sets subscript of the text.
setSuperscriptSets superscript of the text.
setUnderlineSets underline for the text, represented by the {@code TextFragment} object
setWordSpacingSets word spacing of the text.

TabstopDefaultValue

public final float TabstopDefaultValue

Default value of tabulation in widths of space character of default font.

TextState

public TextState()

Creates text state object.

TextState

Creates text state object.

TextState

Creates text state object.

TextState

public TextState(double fontSize)

Creates text state object with font size specification.

Parameters:

ParameterTypeDescription
fontSizeFont size.

TextState

Creates text state object.

TextState

Creates text state object.

TextState

Creates text state object.

applyChangesFrom

Applies settings from another textState


Only those properties will be copied that were changed explicitly.

calculateFontSize

Calculates the font size for the rectangle.

getBackgroundColor

public Color getBackgroundColor()

Gets background color of the text.


Note that the value is not preserved as a text characteristic within the document. The BackgroundColor property getter works for an object in case it was explicitly set previously with BackgroundColor setter for those object. The property is used by runtime in context of current generation/modification process.

Returns: Color value

getCharacterSpacing

public float getCharacterSpacing()

Gets character spacing of the text.

Returns: float value

getCoordinateOrigin

public CoordinateOrigin getCoordinateOrigin()

Gets or sets text CoordinateOrigin. If CoordinateOrigin is Descender, the text Y coordinate corresponds to the font’s lowest point. If CoordinateOrigin is BaseLine, the text Y coordinate corresponds to the font’s baseline. The default value is Descender. If the font’s Descent value is too big, text can be rendered higher than other fonts. In this case, CoordinateOrigin BaseLine can be selected for better text rendering.

Returns: CoordinateOrigin element

getFont

public Font getFont()

Gets font of the text.

Returns: Font object

getfontSize

public float getfontSize()

Represent getfontSize method

Returns: float value

getFontSize

public float getFontSize()

Gets font size of the text.

Returns: float value

getFontStyle

public int getFontStyle()

Sets font style of the text.

Returns: FontStyles element @see FontStyles

getForegroundColor

public Color getForegroundColor()

Gets foreground color of the text.

Returns: Color value

getHorizontalAlignment

public HorizontalAlignment getHorizontalAlignment()

Gets horizontal alignment for the text.


HorizontalAlignment.None is equal to HorizontalAlignment.Left. Note that TextState.HorizontalAlignment property works in new document generation scenarios only.

Returns: HorizontalAlignment value @see HorizontalAlignment

getHorizontalScaling

public float getHorizontalScaling()

Gets horizontal scaling of the text.

Returns: float value

getLineSpacing

public float getLineSpacing()

Gets line spacing of the text.

Returns: float value


Note that the value is not preserved as a text characteristic within the document. The LineSpacing property getter works for an object in case it was explicitly set previously with LineSpacing setter for those object. The property is used by runtime in context of current generation/modification process.

getRenderingMode

public TextRenderingMode getRenderingMode()

Gets or sets rendering mode of text.

Returns: TextRenderingMode element @see TextRenderingMode

getStrokingColor

public Color getStrokingColor()

Gets or sets foreground color of the text.

Returns: Color instance

getTabTag

public final String getTabTag()

You can place this tag in text to declare tabulation.


It has effect only in couple with {@code TabStops}.

Returns: String value “#$TAB”

getTextHeight

public float getTextHeight()

Gets text height.

Returns: float value

getWordSpacing

public float getWordSpacing()

Gets word spacing of the text.

Returns: float value

isInvisible

public boolean isInvisible()

Gets the invisibility of text. This basically reflects the {@code RenderingMode}({@link #getRenderingMode}/{@code #setRenderingMode(TextRenderingMode)}) state, except for some special cases (like clipping).

Returns: boolean value

isStrikeOut

public boolean isStrikeOut()

Gets strikeout for the text, represented by the {@code TextFragment} object

Returns: boolean value

isSubscript

public boolean isSubscript()

Gets or sets subscript of the text.

Returns: boolean value

isSuperscript

public boolean isSuperscript()

Gets superscript of the text.

Returns: boolean value

isUnderline

public boolean isUnderline()

Gets underline for the text, represented by the {@code TextFragment} object

Returns: boolean value

measureHeight

public double measureHeight(char character)

Measures character height.

Parameters:

ParameterTypeDescription
characterCharacter to measure.

Returns: Height of the character if we could get it from font; otherwise 0.

measureString

Measures the string.

measureString

Measures the string.


insideLine indicate that the string is not ending. in case part of the whole string is measured - the insideLine should be true. in case the whole string is measured the insideLine should be false. in other words: in case insideLine = true only character widths are taken into account. no additional transformations are taken into account in case insideLine = false end of the string is handled properly - italic transformation is taken into account.

setBackgroundColor

Sets background color of the text.

setCharacterSpacing

public void setCharacterSpacing(float value)

Sets character spacing of the text.

Parameters:

ParameterTypeDescription
valuefloat value

setCoordinateOrigin

Gets or sets text CoordinateOrigin. If CoordinateOrigin is Descender, the text Y coordinate corresponds to the font’s lowest point. If CoordinateOrigin is BaseLine, the text Y coordinate corresponds to the font’s baseline. The default value is Descender. If the font’s Descent value is too big, text can be rendered higher than other fonts. In this case, CoordinateOrigin BaseLine can be selected for better text rendering.

setFont

Gets font of the text.

setFontSize

public void setFontSize(float value)

Sets font size of the text.

Parameters:

ParameterTypeDescription
valuefloat value

setFontSizeSuppressedUpdate

public void setFontSizeSuppressedUpdate(float value)

Sets font size of the text wish suppressed update.

Parameters:

ParameterTypeDescription
valuefloat value

setFontStyle

public void setFontStyle(int value)

Sets font style of the text.

Parameters:

ParameterTypeDescription
valueFontStyles value @see FontStyles

setFontSuppressedUpdate

Gets font of the text wish suppressed update.

setForegroundColor

Sets foreground color of the text.

setHorizontalAlignment

Sets horizontal alignment for the text.


HorizontalAlignment.None is equal to HorizontalAlignment.Left. Note that TextState.HorizontalAlignment property works in new document generation scenarios only.

setHorizontalScaling

public void setHorizontalScaling(float value)

Sets horizontal scaling of the text.

Parameters:

ParameterTypeDescription
valuefloat value

setInvisible

public void setInvisible(boolean value)

Sets the invisibility of text. This basically reflects the {@code RenderingMode}({@link #getRenderingMode}/{@code #setRenderingMode(TextRenderingMode)}) state, except for some special cases (like clipping).

Parameters:

ParameterTypeDescription
valueboolean value

setLineSpacing

public void setLineSpacing(float value)

Sets line spacing of the text.

Parameters:

ParameterTypeDescription
valuefloat value

Note that the value is not preserved as a text characteristic within the document. The LineSpacing property getter works for an object in case it was explicitly set previously with LineSpacing setter for those object. The property is used by runtime in context of current generation/modification process.

setRenderingMode

Gets or sets rendering mode of text.

setStrikeOut

public void setStrikeOut(boolean value)

Sets strikeout for the text, represented by the {@code TextFragment} object

Parameters:

ParameterTypeDescription
valueboolean value

setStrokingColor

Gets or sets foreground color of the text.

setSubscript

public void setSubscript(boolean value)

Gets or sets subscript of the text.

Parameters:

ParameterTypeDescription
valueboolean value

setSuperscript

public void setSuperscript(boolean value)

Sets superscript of the text.

Parameters:

ParameterTypeDescription
valueboolean value

setUnderline

public void setUnderline(boolean value)

Sets underline for the text, represented by the {@code TextFragment} object

Parameters:

ParameterTypeDescription
valueboolean value

setWordSpacing

public void setWordSpacing(float value)

Sets word spacing of the text.

Parameters:

ParameterTypeDescription
valuefloat value