com.incrediblesoft.redjey
Class CustomFont

java.lang.Object
  extended by com.incrediblesoft.redjey.CustomFont

public class CustomFont
extends java.lang.Object


Method Summary
 int charsWidth(char[] chars, int offset, int length)
           
 int charWidth(char ch)
           
 CustomFont clone()
           
 void drawChar(javax.microedition.lcdui.Graphics g, char ch, int x, int y, int alignment)
           
 void drawChars(javax.microedition.lcdui.Graphics g, char[] data, int offset, int length, int x, int y, int anchor)
           
 void drawString(javax.microedition.lcdui.Graphics g, java.lang.String s, int x, int y, int alignment)
           
 int getColor()
           
static CustomFont getFont(int face, int style, int size, int color)
           
static CustomFont getFont(java.lang.Object descObj)
           
static CustomFont getFont(java.lang.String fontPath)
           
 int getHeight()
           
 void setColor(int color)
           
static java.lang.String[] splitString(java.lang.String text, CustomFont font)
           
static java.lang.String[] splitString(java.lang.String text, CustomFont font, int windowWidth, int numCols)
          Breaks continuous text into set of small strings, each of them is not greater than the given limit.
 int stringWidth(java.lang.String s)
           
 int subStringWidth(java.lang.String s, int offset, int length)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFont

public static CustomFont getFont(java.lang.String fontPath)

getFont

public static CustomFont getFont(int face,
                                 int style,
                                 int size,
                                 int color)

getFont

public static CustomFont getFont(java.lang.Object descObj)

getHeight

public int getHeight()

charWidth

public int charWidth(char ch)

stringWidth

public int stringWidth(java.lang.String s)

subStringWidth

public int subStringWidth(java.lang.String s,
                          int offset,
                          int length)

charsWidth

public int charsWidth(char[] chars,
                      int offset,
                      int length)

drawString

public void drawString(javax.microedition.lcdui.Graphics g,
                       java.lang.String s,
                       int x,
                       int y,
                       int alignment)

drawChar

public void drawChar(javax.microedition.lcdui.Graphics g,
                     char ch,
                     int x,
                     int y,
                     int alignment)

drawChars

public void drawChars(javax.microedition.lcdui.Graphics g,
                      char[] data,
                      int offset,
                      int length,
                      int x,
                      int y,
                      int anchor)

getColor

public int getColor()

setColor

public void setColor(int color)

splitString

public static java.lang.String[] splitString(java.lang.String text,
                                             CustomFont font)

clone

public CustomFont clone()
Overrides:
clone in class java.lang.Object

splitString

public static java.lang.String[] splitString(java.lang.String text,
                                             CustomFont font,
                                             int windowWidth,
                                             int numCols)
Breaks continuous text into set of small strings, each of them is not greater than the given limit.

Parameters:
text - Text to break
font - Font to use
windowWidth - maximum string width.
numCols - maximum string length in characters.
Returns:
Formatted text The text is broken into set of lines depending on the given limits. If you want to set a limit in pixels, use windowWidth, otherwise set this parameter to 0. If you want to set a limit in characters, use numCols, otherwise set this parameter to 0. If windowWidth and numCols are zero the text is broken by matching only new-line character.