Package snap.text
Class TextStyle
java.lang.Object
snap.props.PropObject
snap.text.TextStyle
- All Implemented Interfaces:
Cloneable
,PropChange.DoChange
A class to hold style attributes for a text run.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final TextStyle
static final TextStyle
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Standard clone implementation.Clone with new value.Clone with new values.Clone with key/value.Clone with map.copyForPropsString
(String propsString) Returns a copy of this style for given props string.static TextStyle
createForPropsString
(String propsString) Creates a TextStyle for given prop string.boolean
Standard equals implementation.double
Returns the max distance above the baseline for this run font.Returns the text border.double
getCharAdvance
(char aChar) Returns the char advance for a given character.double
Returns the char spacing.getColor()
Returns the color for this run.double
Returns the max distance below the baseline that this font goes.getFont()
Returns the font for this run.Returns the format.double
Returns the default distance between lines for this font.double
Returns the line advance.double
Returns the line height.getLink()
Returns the link.getPropValue
(String aPropName) Returns the value for given prop name.int
Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).static String
getStyleKey
(Object anAttr) Returns the most likely style key for a given attribute.int
Returns the underline style of this run.int
hashCode()
Standard hashCode implementation.protected void
Initialize Props.boolean
Returns whether this run is underlined.void
setPropValue
(String aPropName, Object aValue) Sets the value for given prop name.Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, firePropChange, firePropChange, firePropChange, getPropDefault, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropsString, setPropValues, toString, toStringProps
-
Field Details
-
Font_Prop
- See Also:
-
Color_Prop
- See Also:
-
Underline_Prop
- See Also:
-
Border_Prop
- See Also:
-
Scripting_Prop
- See Also:
-
CharSpacing_Prop
- See Also:
-
Format_Prop
- See Also:
-
Link_Prop
- See Also:
-
COLOR_KEY
- See Also:
-
UNDERLINE_KEY
- See Also:
-
DEFAULT
-
DEFAULT_LINK_STYLE
-
-
Constructor Details
-
TextStyle
public TextStyle()Creates a new TextStyle. -
TextStyle
Creates a new TextStyle for given attributes.
-
-
Method Details
-
getFont
Returns the font for this run. -
getColor
Returns the color for this run. -
isUnderlined
public boolean isUnderlined()Returns whether this run is underlined. -
getUnderlineStyle
public int getUnderlineStyle()Returns the underline style of this run. -
getScripting
public int getScripting()Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none). -
getCharSpacing
public double getCharSpacing()Returns the char spacing. -
getLink
Returns the link. -
getFormat
Returns the format. -
getBorder
Returns the text border. -
getCharAdvance
public double getCharAdvance(char aChar) Returns the char advance for a given character. -
getAscent
public double getAscent()Returns the max distance above the baseline for this run font. -
getDescent
public double getDescent()Returns the max distance below the baseline that this font goes. -
getLeading
public double getLeading()Returns the default distance between lines for this font. -
getLineHeight
public double getLineHeight()Returns the line height. -
getLineAdvance
public double getLineAdvance()Returns the line advance. -
equals
Standard equals implementation. -
hashCode
public int hashCode()Standard hashCode implementation. -
clone
Standard clone implementation.- Overrides:
clone
in classPropObject
-
copyFor
Clone with new value. -
copyFor
Clone with new values. -
copyFor
Clone with key/value. -
copyFor
Clone with map. -
copyForPropsString
Returns a copy of this style for given props string. -
initProps
Initialize Props. Override to provide custom defaults.- Overrides:
initProps
in classPropObject
-
getPropValue
Returns the value for given prop name.- Overrides:
getPropValue
in classPropObject
-
setPropValue
Sets the value for given prop name.- Overrides:
setPropValue
in classPropObject
-
getStyleKey
Returns the most likely style key for a given attribute. -
createForPropsString
Creates a TextStyle for given prop string.
-