|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.image.CoreFont
public class CoreFont
The CoreFont class is a image-based font used for drawing text.
Method Summary | |
---|---|
CoreFont |
background(int argbColor)
Deprecated. Background colors do not appear correctly |
boolean |
canDisplay(char ch)
|
CoreFont |
fade(int alpha)
Deprecated. Fade dynamically using a Label instead |
int |
getCharPosition(String s,
int beginIndex,
int charIndex)
|
int |
getCharWidth(char ch)
Gets the width of the specified character. |
int |
getHeight()
|
CoreImage |
getImage()
|
int |
getKerning(char left,
char right)
|
int |
getStringWidth(String s)
Gets the total width of all the characters in a string. |
int |
getStringWidth(String s,
int beginIndex,
int endIndex)
Gets the total width of a range of characters in a string. |
static CoreFont |
getSystemFont()
|
static CoreFont |
load(String fontAsset)
Loads a PNG-based image font from the asset catalog. |
CoreFont |
scale(double scale)
Deprecated. Scale dynamically using a Label instead |
CoreFont |
tint(int rgbColor)
Returns a new CoreFont with every pixel set to the specified color, without changing the alpha of each pixel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static CoreFont getSystemFont()
public static CoreFont load(String fontAsset)
This method never returns null
.
If the image is not found, or the PNG image does not have font information,
an error is printed to the log
and the system font is returned. If the system font cannot be found, an Error is thrown.
PNG-based image fonts are created from a font.properties file. See the Text example in the distribution archive.
Fonts are internally cached (using a WeakReference), and if the font was previously loaded, this method may return the same reference.
fontAsset
- The name of a PNG image file with font information.
public boolean canDisplay(char ch)
public int getStringWidth(String s)
Equivalent to calling getStringWidth(s, 0, s.length())
public int getStringWidth(String s, int beginIndex, int endIndex)
beginIndex
- the beginning index, inclusive.endIndex
- the ending index, exclusive.public int getCharPosition(String s, int beginIndex, int charIndex)
public int getCharWidth(char ch)
public int getKerning(char left, char right)
public int getHeight()
public CoreImage getImage()
public CoreFont tint(int rgbColor)
Tinted fonts are internally cached using SoftReferences.
public CoreFont background(int argbColor)
public CoreFont fade(int alpha)
public CoreFont scale(double scale)
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |