|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.yospace.yae.yogi.Font
|
+--com.yospace.yae.yogi.CustomFont
This font class is a YoGI replacement for the MIDP font class. It offers the same functionality as MIDP fonts but extends it to allow antialiased fonts and kerned fonts. It uses fonts that have the ".yaef" extension. The way that the implementation works means that the speed of rendering and the amount of memory taken is directly proportional to the size of the source file for the font.
| Fields inherited from class com.yospace.yae.yogi.Font |
FACE_MONOSPACE, FACE_PROPORTIONAL, FACE_SYSTEM, SIZE_LARGE, SIZE_MEDIUM, SIZE_SMALL, STYLE_BOLD, STYLE_ITALIC, STYLE_PLAIN, STYLE_UNDERLINED |
| Constructor Summary | |
protected |
CustomFont(java.lang.String name)
Creates a CustomFont given a resource name for the font file. |
| Method Summary | |
int |
charsWidth(char[] ch,
int offset,
int length)
Returns the width in pixels of a subset of a character array (kerning WILL affect the width returned). |
int |
charWidth(char ch)
Returns the width in pixels of a character (kerning will NOT affect the width of the character). |
void |
drawGlyph(Graphics g,
char c,
int x,
int y)
Renders a character onto a Graphics at a specified position, which is the top left of the character (no kerning will occur when drawing characters individually like this). |
void |
drawGlyph(Graphics g,
char c,
int x,
int y,
int backgroundColor)
Renders a character onto a Graphics at a specified position, which is the top left of the character, with a specified background color (no kerning will occur when drawing characters individually like this). |
void |
drawString(Graphics g,
java.lang.String s,
int x,
int y)
Renders a String onto a Graphics at a specified position, which is the top left of the String (kerning will occur if the font contains kerning information). |
void |
drawString(Graphics g,
java.lang.String s,
int x,
int y,
int backgroundColor)
Renders a String onto a Graphics at a specified position, which is the top left of the String, with a specified background color (kerning will occur if the font contains kerning information). |
int |
getBaselinePosition()
Returns the distance in pixels from the top of the text to the text's baseline (as per MIDP Font class). |
int |
getFace()
Returns the face of the Font (as per MIDP Font class). |
int |
getHeight()
Returns the height of the font (as per MIDP Font class). |
java.lang.String |
getName()
Returns the name of this font. |
int |
getSize()
Returns the size of the Font (as per MIDP Font class). |
int |
getStyle()
Returns the style of the Font (as per MIDP Font class). |
boolean |
isBold()
Returns whether the font is bold (as per MIDP Font class). |
boolean |
isItalic()
Returns whether the font is italic (as per MIDP Font class). |
boolean |
isPlain()
Returns whether the font is plain (as per MIDP Font class). |
boolean |
isUnderlined()
Returns whether the font is underlined (as per MIDP Font class). |
int |
stringWidth(java.lang.String str)
Returns the width in pixels of a String (kerning WILL affect the width returned). |
int |
substringWidth(java.lang.String str,
int offset,
int length)
Returns the width in pixels of a subset of a String (kerning WILL affect the width returned). |
| Methods inherited from class com.yospace.yae.yogi.Font |
getDefaultFont, getFont, getFont, getFontSmallerThan |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected CustomFont(java.lang.String name)
throws java.io.IOException
name - the resource to load the font from.java.io.IOException - if an I/O error occurs.| Method Detail |
public java.lang.String getName()
public int getStyle()
getStyle in class Fontpublic int getSize()
getSize in class Fontpublic int getFace()
getFace in class Fontpublic boolean isPlain()
isPlain in class Fontpublic boolean isBold()
isBold in class Fontpublic boolean isItalic()
isItalic in class Fontpublic boolean isUnderlined()
isUnderlined in class Fontpublic int getHeight()
getHeight in class Fontpublic int getBaselinePosition()
getBaselinePosition in class Fontpublic int charWidth(char ch)
charWidth in class Fontch - the character to find the width of.
public int charsWidth(char[] ch,
int offset,
int length)
charsWidth in class Fontch - the source character array.offset - the index of the first character in the subset.length - the total number of characters in the subset.public int stringWidth(java.lang.String str)
stringWidth in class Fontstr - the String.
public int substringWidth(java.lang.String str,
int offset,
int length)
substringWidth in class Fontstr - the source String.offset - the index of the first character in the subset.length - the total number of characters in the subset.
public void drawGlyph(Graphics g,
char c,
int x,
int y)
drawGlyph in class Fontg - the Graphics area to draw onto.c - the character to be drawn.x - the x coordinate of the top-left location which the character will be drawn from.y - the y coordinate of the top-left location which the character will be drawn from.
public void drawString(Graphics g,
java.lang.String s,
int x,
int y)
drawString in class Fontg - the Graphics area to draw onto.s - the String to be drawn.x - the x coordinate of the top-left location which the String will be drawn from.y - the y coordinate of the top-left location which the String will be drawn from.
public void drawGlyph(Graphics g,
char c,
int x,
int y,
int backgroundColor)
drawGlyph in class Fontg - the Graphics area to draw onto.c - the character to be drawn.x - the x coordinate of the top-left location which the character will be drawn from.y - the y coordinate of the top-left location which the character will be drawn from.backgroundColor - the background color that will be used.
public void drawString(Graphics g,
java.lang.String s,
int x,
int y,
int backgroundColor)
drawString in class Fontg - the Graphics area to draw onto.s - the String to be drawn.x - the x coordinate of the top-left location which the String will be drawn from.y - the y coordinate of the top-left location which the String will be drawn from.backgroundColor - the background color that will be used.
|
Copyright 2002 Yospace Holdings Ltd. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||