|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.processing.PFont
public class PFont
Placeholder class that emulates the behavior of a Mobile Processing PFont, for compatibility with existing Mobile Processing scripts. The class actually uses J2ME Polish bitmap fonts instead.
| Field Summary | |
|---|---|
protected int |
bgColor
|
protected BitMapFont |
bitmapFont
|
protected int |
color
|
static int |
FACE_MONOSPACE
|
static int |
FACE_PROPORTIONAL
|
static int |
FACE_SYSTEM
|
protected Font |
platformFont
|
static int |
SIZE_LARGE
|
static int |
SIZE_MEDIUM
|
static int |
SIZE_SMALL
|
static int |
STYLE_BOLD
|
static int |
STYLE_ITALIC
|
static int |
STYLE_PLAIN
|
static int |
STYLE_UNDERLINED
|
protected boolean |
useNativeFontColor
|
| Constructor Summary | |
|---|---|
PFont(Font font)
Creates a new PFont instance |
|
PFont(String fontUrl)
Creates a new PFont instance from a J2MEPolish font |
|
PFont(String fontUrl,
color textColor,
color bgColor)
Creates a new PFont instance from a J2MEPolish font |
|
| Method Summary | |
|---|---|
int |
charsWidth(char[] ch,
int offset,
int length)
Returns the width of the given char arary or of a sub-array of thereof when drawn with the given font |
int |
charWidth(char ch)
Returns the width of the given char when drawn with the current font |
void |
draw(Graphics g,
String str,
int x,
int y,
int textAlign)
Draws a string at the specified position |
int |
getBaseline()
Returns the font's baseline position |
int |
getHeight()
Gets the font height |
boolean |
isBitmapFont()
Returns if the current font is a bitmap one or not |
int |
stringWidth(String str)
Returns the width of the given string when drawn with the current font |
int |
substringWidth(String str,
int offset,
int length)
Returns the width of a substring when drawn with the current font |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Font platformFont
protected BitMapFont bitmapFont
protected int color
protected int bgColor
protected boolean useNativeFontColor
public static int FACE_SYSTEM
public static int FACE_MONOSPACE
public static int FACE_PROPORTIONAL
public static int SIZE_LARGE
public static int SIZE_MEDIUM
public static int SIZE_SMALL
public static int STYLE_PLAIN
public static int STYLE_BOLD
public static int STYLE_ITALIC
public static int STYLE_UNDERLINED
| Constructor Detail |
|---|
public PFont(Font font)
font - the font to usepublic PFont(String fontUrl)
fontUrl - the URL from where to load the font
public PFont(String fontUrl,
color textColor,
color bgColor)
fontUrl - the URL from where to load the fonttextColor - the text colorbgColor - the background color| Method Detail |
|---|
public int getHeight()
public int getBaseline()
public int charsWidth(char[] ch,
int offset,
int length)
ch - the char array in questionoffset - the offset at which to start the subsetlength - the length of the subset
public int charWidth(char ch)
ch - the char in question
public int stringWidth(String str)
str - the string in question
public int substringWidth(String str,
int offset,
int length)
str - the whole stringoffset - the offset of the desired substringlength - the substring length
public void draw(Graphics g,
String str,
int x,
int y,
int textAlign)
g - the Graphics object to draw onstr - the string to drawx - the x-coordinate of the drawing positiony - the y-coordinate of the drawing positiontextAlign - the text alignment to usepublic boolean isBitmapFont()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||