Class TextStyle

java.lang.Object
playn.core.TextFormat
tripleplay.util.TextStyle

public class TextStyle extends TextFormat
Describes everything needed to style a particular run of text.
  • Field Details

    • DEFAULT

      public static TextStyle DEFAULT
      A default text style from which custom styles can be derived.
    • textColor

      public final int textColor
      The color used to render the text.
    • effect

      public final EffectRenderer effect
      The text effect used when rendering the text.
    • underlined

      public final boolean underlined
      Whether or not the text is underlined.
  • Constructor Details

    • TextStyle

      public TextStyle(Font font, boolean antialias, int textColor, EffectRenderer effect, boolean underlined)
      Creates a text style with the specified configuration.
  • Method Details

    • normal

      public static TextStyle normal(Font font, int textColor)
      Creates a text style with the specified configuration using default anti-aliasing, no effect and no underline.
    • normal

      public static TextStyle normal(Font font, int textColor, EffectRenderer effect)
      Creates a text style with the specified configuration using default anti-aliasing (true) and no underline.
    • withFont

      public TextStyle withFont(Font font)
      Overrides:
      withFont in class TextFormat
    • withAntialias

      public TextStyle withAntialias(boolean antialias)
      Overrides:
      withAntialias in class TextFormat
    • withTextColor

      public TextStyle withTextColor(int textColor)
      Returns a copy of this text style with the color configured as textColor.
    • withEffect

      public TextStyle withEffect(EffectRenderer effect)
      Returns a copy of this text style with the effect configured as effect.
    • withShadow

      public TextStyle withShadow(int shadowColor, float shadowX, float shadowY)
      Returns a copy of this text style with a shadow text effect.
    • withOutline

      public TextStyle withOutline(int outlineColor)
      Returns a copy of this text style with a pixel outline text effect.
    • withOutline

      public TextStyle withOutline(int outlineColor, float outlineWidth)
      Returns a copy of this text style with a vector outline text effect.
    • withUnderline

      public TextStyle withUnderline(boolean underlined)
      Returns a copy of this text style with (or without) underlining.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TextFormat
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class TextFormat