Class StyleParser.FontInfo

java.lang.Object
com.codename1.ui.plaf.StyleParser.FontInfo
Enclosing class:
StyleParser

public static class StyleParser.FontInfo extends Object
Encapsulates the value of the font property in a style string.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createFont(Style baseStyle)
    Creates a font based on this font information.
    Gets the font file name.
    Gets the name of the font.
    Gets the font size.
    float
    Gets the size of the font in pixels.
    byte
    Gets the font size unit.
    void
    Sets the font file name.
    void
    Sets the name of the font.
    void
    setSize(Float size)
    Sets the font size.
    void
    setSizeUnit(byte sizeUnit)
    Sets the font size unit.
    Gets the font size as a style string.
    Returns the font in a format that can be used as the value of the font property of a style string.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • Constructor Details

    • FontInfo

      public FontInfo()
  • Method Details

    • toString

      public String toString()
      Returns the font in a format that can be used as the value of the font property of a style string.
      Overrides:
      toString in class Object
    • sizeString

      public String sizeString(String prefix)

      Gets the font size as a style string. E.g. 18mm, or 12px. If unit is inherit, this will just return an empty string.

      Parameters
      • prefix: String to prefix to the size.
    • getSizeInPixels

      public float getSizeInPixels(Style baseStyle)

      Gets the size of the font in pixels.

      Parameters
      • baseStyle: The base style to use in case the font size isn't specified in the style string.
    • getSize

      public Float getSize()

      Gets the font size.

      Returns

      the size

      See also
      • #getSizeUnit()
    • setSize

      public void setSize(Float size)

      Sets the font size.

      Parameters
      • size: the size to set
      See also
      • #setSizeUnit(byte)
    • getSizeUnit

      public byte getSizeUnit()

      Gets the font size unit. One of Style#UNIT_TYPE_DIPS, Style#UNIT_TYPE_PIXELS, or #UNIT_INHERIT.

      Returns

      the sizeUnit

    • setSizeUnit

      public void setSizeUnit(byte sizeUnit)

      Sets the font size unit. One of Style#UNIT_TYPE_DIPS, Style#UNIT_TYPE_PIXELS, or #UNIT_INHERIT.

      Parameters
      • sizeUnit: the sizeUnit to set
    • getName

      public String getName()

      Gets the name of the font.

      Returns

      the name

    • setName

      public void setName(String name)

      Sets the name of the font.

      Parameters
      • name: the name to set
    • getFile

      public String getFile()

      Gets the font file name. Should start with "/".

      Returns

      the file

    • setFile

      public void setFile(String file)

      Sets the font file name. Should start with "/".

      Parameters
      • file: the file to set
    • createFont

      public Font createFont(Style baseStyle)

      Creates a font based on this font information.

      Parameters
      • baseStyle: The base style to use in cases where aspects of the font aren't explicitly specified in the style string.
      Returns

      A font.