Package playn.core

Class TextFormat

java.lang.Object
playn.core.TextFormat

public class TextFormat extends Object
Contains info for laying out and drawing single- or multi-line text to a Canvas.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final boolean
    Whether or not the text should be antialiased.
    final Font
    The font in which to render the text (null indicates that the default font is used).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a default text format instance.
    Creates a text format instance with the specified font.
    TextFormat(Font font, boolean antialias)
    Creates a configured text format instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
     
    int
     
     
    withAntialias(boolean antialias)
    Returns a clone of this text format with antialias configured as specified.
    withFont(String name, float size)
    Returns a clone of this text format with the font configured as specified.
    withFont(String name, Font.Style style, float size)
    Returns a clone of this text format with the font configured as specified.
    withFont(Font font)
    Returns a clone of this text format with the font configured as specified.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • font

      public final Font font
      The font in which to render the text (null indicates that the default font is used).
    • antialias

      public final boolean antialias
      Whether or not the text should be antialiased. Defaults to true. NOTE: this is not supported by the HTML5 backend.
  • Constructor Details

    • TextFormat

      public TextFormat()
      Creates a default text format instance.
    • TextFormat

      public TextFormat(Font font)
      Creates a text format instance with the specified font.
    • TextFormat

      public TextFormat(Font font, boolean antialias)
      Creates a configured text format instance.
  • Method Details

    • withFont

      public TextFormat withFont(Font font)
      Returns a clone of this text format with the font configured as specified.
    • withFont

      public TextFormat withFont(String name, Font.Style style, float size)
      Returns a clone of this text format with the font configured as specified.
    • withFont

      public TextFormat withFont(String name, float size)
      Returns a clone of this text format with the font configured as specified.
    • withAntialias

      public TextFormat withAntialias(boolean antialias)
      Returns a clone of this text format with antialias configured as specified.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object