public class TextState extends Object
Represents a text state of a text
Modifier and Type | Field and Description |
---|---|
float |
TabstopDefaultValue
Default value of tabulation in widths of space character of default font.
|
static String |
TabTag
You can place this tag in text to declare tabulation.
|
Constructor and Description |
---|
TextState()
Creates text state object.
|
TextState(Color foregroundColor)
Creates text state object with foreground color specification.
|
TextState(Color foregroundColor,
double fontSize)
Creates text state object with foreground color and font size specification.
|
TextState(double fontSize)
Creates text state object with font size specification.
|
TextState(String fontFamily)
Creates text state object with font family specification.
|
TextState(String fontFamily,
boolean bold,
boolean italic)
Creates text state object with font family and font style specification.
|
TextState(String fontFamily,
double fontSize)
Creates text state object with font family and font size specification.
|
Modifier and Type | Method and Description |
---|---|
void |
applyChangesFrom(TextState textState)
Applies settings from another textState
Only those properties will be copied that were changed explicitly.
|
double |
calculateFontSize(String str,
Rectangle rect)
Calculates the font size for the rectangle.
|
Color |
getBackgroundColor()
Gets background color of the text.
|
float |
getCharacterSpacing()
Gets character spacing of the text.
|
Font |
getFont()
Gets font of the text.
|
float |
getFontSize()
Gets font size of the text.
|
int |
getFontStyle()
Sets font style of the text.
|
Color |
getForegroundColor()
Gets foreground color of the text.
|
int |
getHorizontalAlignment()
Gets horizontal alignment for the text.
|
float |
getHorizontalScaling()
Gets horizontal scaling of the text.
|
float |
getLineSpacing()
Gets line spacing of the text.
|
int |
getRenderingMode()
Gets or sets rendering mode of text.
|
boolean |
getStrikeOut()
Gets strikeout for the text, represented by the
TextFragment object
|
Color |
getStrokingColor()
Gets or sets foreground color of the text.
|
float |
getTextHeight()
Gets text height.
|
float |
getWordSpacing()
Gets word spacing of the text.
|
boolean |
isInvisible()
Gets invisibility of the text.
|
boolean |
isSubscript()
Gets or sets subscript of the text.
|
boolean |
isSuperscript()
Gets superscript of the text.
|
boolean |
isUnderline()
Gets underline for the text, represented by the
TextFragment object
|
double |
measureString(String str)
Measures the string.
|
double |
measureString(String str,
boolean insideLine)
Measures the string.
|
void |
setBackgroundColor(Color value)
Sets background color of the text.
|
void |
setCharacterSpacing(float value)
Sets character spacing of the text.
|
void |
setFont(Font value)
Gets font of the text.
|
void |
setFontSize(float value)
Sets font size of the text.
|
void |
setFontSizeSuppressedUpdate(float value)
Sets font size of the text wish suppressed update.
|
void |
setFontStyle(int value)
Sets font style of the text.
|
void |
setFontSuppressedUpdate(Font value)
Gets font of the text wish suppressed update.
|
void |
setForegroundColor(Color value)
Sets foreground color of the text.
|
void |
setHorizontalAlignment(int value)
Sets horizontal alignment for the text.
|
void |
setHorizontalScaling(float value)
Sets horizontal scaling of the text.
|
void |
setInvisible(boolean value)
Sets invisibility of the text.
|
void |
setLineSpacing(float value)
Sets line spacing of the text.
|
void |
setRenderingMode(int value)
Gets or sets rendering mode of text.
|
void |
setStrikeOut(boolean value)
Sets strikeout for the text, represented by the
TextFragment object
|
void |
setStrokingColor(Color value)
Gets or sets foreground color of the text.
|
void |
setSubscript(boolean value)
Gets or sets subscript of the text.
|
void |
setSuperscript(boolean value)
Sets superscript of the text.
|
void |
setUnderline(boolean value)
Sets underline for the text, represented by the
TextFragment object
|
void |
setWordSpacing(float value)
Sets word spacing of the text.
|
public static final String TabTag
You can place this tag in text to declare tabulation.
It has effect only in couple with TabStops
.
public final float TabstopDefaultValue
Default value of tabulation in widths of space character of default font.
public TextState()
Creates text state object.
public TextState(double fontSize)
Creates text state object with font size specification.
fontSize
- Font size.public TextState(Color foregroundColor)
Creates text state object with foreground color specification.
foregroundColor
- Foreground color.public TextState(Color foregroundColor, double fontSize)
Creates text state object with foreground color and font size specification.
foregroundColor
- Foreground color.fontSize
- Font size.public TextState(String fontFamily)
Creates text state object with font family specification.
fontFamily
- Font family.public TextState(String fontFamily, boolean bold, boolean italic)
Creates text state object with font family and font style specification.
fontFamily
- Font family.bold
- Bold font style.italic
- Italic font style.public TextState(String fontFamily, double fontSize)
Creates text state object with font family and font size specification.
fontFamily
- Font family.fontSize
- Font size.public void applyChangesFrom(TextState textState)
Applies settings from another textState
Only those properties will be copied that were changed explicitly.
textState
- Text state object.public float getCharacterSpacing()
Gets character spacing of the text.
public void setCharacterSpacing(float value)
Sets character spacing of the text.
value
- float valuepublic float getLineSpacing()
Gets line spacing of the text.
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.
public void setLineSpacing(float value)
Sets line spacing of the text.
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.
public float getHorizontalScaling()
Gets horizontal scaling of the text.
public void setHorizontalScaling(float value)
Sets horizontal scaling of the text.
value
- float valuepublic boolean isSubscript()
Gets or sets subscript of the text.
public void setSubscript(boolean value)
Gets or sets subscript of the text.
value
- boolean valuepublic boolean isSuperscript()
Gets superscript of the text.
public void setSuperscript(boolean value)
Sets superscript of the text.
value
- boolean valuepublic float getWordSpacing()
Gets word spacing of the text.
public void setWordSpacing(float value)
Sets word spacing of the text.
value
- float valuepublic boolean isInvisible()
Gets invisibility of the text. Obsolete. Please use RenderingMode instead.
public void setInvisible(boolean value)
Sets invisibility of the text. Obsolete. Please use RenderingMode instead.
value
- boolean valuepublic int getRenderingMode()
Gets or sets rendering mode of text.
TextRenderingMode
public void setRenderingMode(int value)
Gets or sets rendering mode of text.
value
- TextRenderingMode elementTextRenderingMode
public float getFontSize()
Gets font size of the text.
public void setFontSizeSuppressedUpdate(float value)
Sets font size of the text wish suppressed update.
value
- float valuepublic void setFontSize(float value)
Sets font size of the text.
value
- float valuepublic float getTextHeight()
Gets text height.
public Font getFont()
Gets font of the text.
public void setFontSuppressedUpdate(Font value)
Gets font of the text wish suppressed update.
value
- Font objectpublic void setFont(Font value)
Gets font of the text.
value
- Font objectpublic Color getForegroundColor()
Gets foreground color of the text.
public void setForegroundColor(Color value)
Sets foreground color of the text.
value
- Color valuepublic Color getStrokingColor()
Gets or sets foreground color of the text.
public void setStrokingColor(Color value)
Gets or sets foreground color of the text.
value
- Color instancepublic boolean isUnderline()
Gets underline for the text, represented by the TextFragment
object
public void setUnderline(boolean value)
Sets underline for the text, represented by the TextFragment
object
value
- boolean valuepublic boolean getStrikeOut()
Gets strikeout for the text, represented by the TextFragment
object
public void setStrikeOut(boolean value)
Sets strikeout for the text, represented by the TextFragment
object
value
- boolean valuepublic 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.
public void setBackgroundColor(Color value)
Sets 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.
value
- Color valuepublic int getFontStyle()
Sets font style of the text.
FontStyles
public void setFontStyle(int value)
Sets font style of the text.
value
- FontStyles valueFontStyles
public int 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.
HorizontalAlignment
public void setHorizontalAlignment(int value)
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.
value
- HorizontalAlignment valueHorizontalAlignment
public double measureString(String str, boolean insideLine)
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.
str
- String valueinsideLine
- boolean valuepublic double measureString(String str)
str
- The string.