de.enough.polish.util
Class BitMapFont

java.lang.Object
  extended by de.enough.polish.util.BitMapFont

public final class BitMapFont
extends java.lang.Object

Can be used to use any kind of bitmap fonts.

Copyright Enough Software 2004 - 2008

Author:
Robert Virkus, j2mepolish@enough.de

Method Summary
 int charWidth(char c)
          Retrieves the width of the given character
 int getFontHeight()
          Retrieves the height of this bitmap font
static BitMapFont getInstance(java.lang.String url)
          Gets the instance of the specified font.
 BitMapFontViewer getViewer(java.lang.String input)
          Creates a viewer object for the given string.
static void removeInstance(java.lang.String url)
          Removes the instance of the specified font from the internal cache.
 int stringWidth(java.lang.String str)
          Retrieves the width of the given text
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getViewer

public BitMapFontViewer getViewer(java.lang.String input)
Creates a viewer object for the given string.

Parameters:
input - the input which should be shown.
Returns:
a viewer object which shows the font in a performant manner

getInstance

public static BitMapFont getInstance(java.lang.String url)
Gets the instance of the specified font.

Parameters:
url - the url of the font
Returns:
the corresponding bitmap font.

removeInstance

public static void removeInstance(java.lang.String url)
Removes the instance of the specified font from the internal cache.

Parameters:
url - the url of the font

charWidth

public int charWidth(char c)
Retrieves the width of the given character

Parameters:
c - the character
Returns:
-1 if unknown otherwise the width for the given character

stringWidth

public int stringWidth(java.lang.String str)
Retrieves the width of the given text

Parameters:
str - the text
Returns:
-1 if unknown otherwise the width for the given text

getFontHeight

public int getFontHeight()
Retrieves the height of this bitmap font

Returns:
the height of the font