public static class StyleParser.FontInfo
- Object
- StyleParser.FontInfo
Encapsulates the value of the font property in a style string.
Constructors
public FontInfo() |
Methods
public String toString() | Returns the font in a format that can be used as the value of the font property of a style string. |
public String sizeString(String prefix) | Gets the font size as a style string. |
public float getSizeInPixels(Style baseStyle) | Gets the size of the font in pixels. |
public Float getSize() | Gets the font size. |
public void setSize(Float size) | Sets the font size. |
public byte getSizeUnit() | Gets the font size unit. |
public void setSizeUnit(byte sizeUnit) | Sets the font size unit. |
public String getName() | Gets the name of the font. |
public void setName(String name) | Sets the name of the font. |
public String getFile() | Gets the font file name. |
public void setFile(String file) | Sets the font file name. |
public Font createFont(Style baseStyle) | Creates a font based on this font information. |
Inherited methods
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.
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
prefixString- String to prefix to the size.
getSizeInPixels
public float getSizeInPixels(Style baseStyle)Gets the size of the font in pixels.
Parameters
baseStyleStyle- 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
setSize
public void setSize(Float size)Sets the font size.
Parameters
sizeFloat- the size to set
See also
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
sizeUnitbyte- 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
nameString- 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
fileString- the file to set
createFont
public Font createFont(Style baseStyle)Creates a font based on this font information.
Parameters
baseStyleStyle- The base style to use in cases where aspects of the font aren’t explicitly specified in the style string.
Returns
A font.