Package snap.text
Class StyledString
java.lang.Object
snap.text.StyledString
- All Implemented Interfaces:
Cloneable
This class holds a String and TextStyle and provides painting and sizing information.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a copy of this TextRun.double
Returns the ascent.int
getCharIndexForX
(double aX) Returns the char index for the X location.double
Returns the descent.getFont()
Returns the font.int
Returns the run's scripting.Returns the string.Returns the text fill.double
Returns the height of the current string/font (aka the 'line height').Returns the TextStyle.double
Returns the width of the string (aka the 'advance').boolean
Returns whether to size to font (looser) instead of glyphs (tighter).boolean
Returns whether this run is underlined.int
length()
Returns the text length.void
paintString
(Painter aPntr, double aX, double aY) Paints StringView.void
paintStringTopLeft
(Painter aPntr, double aX, double aY) Paints StringView with upper left XY.void
Sets the font.void
setFontSizing
(boolean aValue) Sets whether to size to font (looser) instead of glyphs (tighter).void
Sets the string.void
setTextFill
(Paint aPaint) Sets the text fill.void
setTextStyle
(TextStyle aStyle) Sets the TextStyle.void
setUnderlined
(boolean aValue) Sets whether this run is underlined.
-
Field Details
-
_fontSizing
protected boolean _fontSizing
-
-
Constructor Details
-
StyledString
public StyledString()Constructor. -
StyledString
Constructor.
-
-
Method Details
-
getString
Returns the string. -
setString
Sets the string. -
getTextStyle
Returns the TextStyle. -
setTextStyle
Sets the TextStyle. -
getFont
Returns the font. -
setFont
Sets the font. -
getTextFill
Returns the text fill. -
setTextFill
Sets the text fill. -
isUnderlined
public boolean isUnderlined()Returns whether this run is underlined. -
setUnderlined
public void setUnderlined(boolean aValue) Sets whether this run is underlined. -
getScripting
public int getScripting()Returns the run's scripting. -
isFontSizing
public boolean isFontSizing()Returns whether to size to font (looser) instead of glyphs (tighter). -
setFontSizing
public void setFontSizing(boolean aValue) Sets whether to size to font (looser) instead of glyphs (tighter). -
length
public int length()Returns the text length. -
getTextWidth
public double getTextWidth()Returns the width of the string (aka the 'advance'). -
getTextHeight
public double getTextHeight()Returns the height of the current string/font (aka the 'line height'). -
getAscent
public double getAscent()Returns the ascent. -
getDescent
public double getDescent()Returns the descent. -
getCharIndexForX
public int getCharIndexForX(double aX) Returns the char index for the X location. -
paintString
Paints StringView. -
paintStringTopLeft
Paints StringView with upper left XY. -
clone
Returns a copy of this TextRun.
-