TextState
Inheritance: java.lang.Object, com.aspose.pdf.TextState
public class TextState extends Object
Represents a text state of a text
Fields
| Field | Description |
|---|---|
| TabstopDefaultValue | Default value of tabulation in widths of space character of default font. |
Constructors
| Constructor | Description |
|---|---|
| TextState | Creates text state object. |
| TextState | Creates text state object. |
| TextState | Creates text state object. |
| TextState | Creates text state object with font size specification. |
| TextState | Creates text state object. |
| TextState | Creates text state object. |
| TextState | Creates text state object. |
Methods
| Method | Description |
|---|---|
| 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 | 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. |
| getCharacterSpacing | Gets character spacing of the text. |
| 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. |
| getFont | Gets font of the text. |
| getfontSize | Represent getfontSize method |
| getFontSize | Gets font size of the text. |
| getFontStyle | Sets font style of the text. |
| getForegroundColor | Gets 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. |
| getHorizontalScaling | Gets horizontal scaling of the text. |
| getLineSpacing | Gets line spacing of the text. |
| getRenderingMode | Gets or sets rendering mode of text. |
| getStrokingColor | Gets 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}. |
| getTextHeight | Gets text height. |
| getWordSpacing | Gets word spacing of the text. |
| 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). |
| isStrikeOut | Gets strikeout for the text, represented by the {@code TextFragment} object |
| isSubscript | Gets or sets subscript of the text. |
| isSuperscript | Gets superscript of the text. |
| isUnderline | Gets underline for the text, represented by the {@code TextFragment} object |
| measureHeight | Measures character height. |
| 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 | Sets character spacing of the text. |
| 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 | Sets font size of the text. |
| setFontSizeSuppressedUpdate | Sets font size of the text wish suppressed update. |
| setFontStyle | Sets font style of the text. |
| 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 | Sets horizontal scaling of the text. |
| setInvisible | Sets 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. |
| setRenderingMode | Gets or sets rendering mode of text. |
| setStrikeOut | Sets strikeout for the text, represented by the {@code TextFragment} object |
| setStrokingColor | Gets or sets foreground color of the text. |
| setSubscript | Gets or sets subscript of the text. |
| setSuperscript | Sets superscript of the text. |
| setUnderline | Sets underline for the text, represented by the {@code TextFragment} object |
| setWordSpacing | Sets 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:
| Parameter | Type | Description |
|---|---|---|
| fontSize | Font 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:
| Parameter | Type | Description |
|---|---|---|
| character | Character 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:
| Parameter | Type | Description |
|---|---|---|
| value | float 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:
| Parameter | Type | Description |
|---|---|---|
| value | float value |
setFontSizeSuppressedUpdate
public void setFontSizeSuppressedUpdate(float value)
Sets font size of the text wish suppressed update.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float value |
setFontStyle
public void setFontStyle(int value)
Sets font style of the text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | FontStyles 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:
| Parameter | Type | Description |
|---|---|---|
| value | float 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:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setLineSpacing
public void setLineSpacing(float value)
Sets line spacing of the text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | 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. |
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:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setStrokingColor
Gets or sets foreground color of the text.
setSubscript
public void setSubscript(boolean value)
Gets or sets subscript of the text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setSuperscript
public void setSuperscript(boolean value)
Sets superscript of the text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setUnderline
public void setUnderline(boolean value)
Sets underline for the text, represented by the {@code TextFragment} object
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setWordSpacing
public void setWordSpacing(float value)
Sets word spacing of the text.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float value |