Package snap.text

Class TextStyle

java.lang.Object
snap.text.TextStyle
All Implemented Interfaces:
Cloneable

public class TextStyle extends Object implements Cloneable
A class to hold style attributes for a text run.
  • Field Details

  • Constructor Details

    • TextStyle

      public TextStyle()
      Creates a new TextStyle.
    • TextStyle

      public TextStyle(Object... theAttrs)
      Creates a new TextStyle for given attributes.
  • Method Details

    • getFont

      public Font getFont()
      Returns the font for this run.
    • getColor

      public Color 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

      public TextLink getLink()
      Returns the link.
    • getFormat

      public TextFormat getFormat()
      Returns the format.
    • getBorder

      public Border 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

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Standard hashCode implementation.
      Overrides:
      hashCode in class Object
    • clone

      public TextStyle clone()
      Standard clone implementation.
      Overrides:
      clone in class Object
    • copyFor

      public TextStyle copyFor(Object anObj)
      Clone with new value.
    • copyFor

      public TextStyle copyFor(Object... theObjs)
      Clone with new values.
    • copyFor

      public TextStyle copyFor(String aKey, Object aValue)
      Clone with key/value.
    • copyFor

      public TextStyle copyFor(Map<?,?> aMap)
      Clone with map.
    • setValue

      protected void setValue(String aKey, Object aValue)
      Clone with key/value.
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object
    • getStyleKey

      public static String getStyleKey(Object anAttr)
      Returns the most likely style key for a given attribute.