javax.microedition.lcdui
Class Font

java.lang.Object
  extended by javax.microedition.lcdui.Font

public class Font
extends Object

Provides access to fonts for use with the display or images. The actual font data is held as a series of glyphs with all inter character spacing removed. The format of the bitmap is in standard leJOS format (so aligned for use on NXT LCD display). There is one bit per pixel. The pixels are packed into bytes with each byte spanning 8 scan lines. The least significant bit of each byte is the pixel for the top most scan line, the most significant bit is the 8th scan line. Values of 1 represent black. 0 white.

Author:
Andy

Field Summary
static int SIZE_LARGE
           
static int SIZE_MEDIUM
           
static int SIZE_SMALL
           
 
Method Summary
 int getBaselinePosition()
          Return the base line position in pixels.
static Font getDefaultFont()
          Return the system font.
static Font getFont(int face, int style, int size)
          Request a particular type and size of font.
 int getHeight()
          return the height of the font in pixels.
static Font getLargeFont()
          Return the large font.
static Font getSmallFont()
          Return the small font.
 int stringWidth(String str)
          Return the width of the specified string in pixels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE_SMALL

public static final int SIZE_SMALL
See Also:
Constant Field Values

SIZE_MEDIUM

public static final int SIZE_MEDIUM
See Also:
Constant Field Values

SIZE_LARGE

public static final int SIZE_LARGE
See Also:
Constant Field Values
Method Detail

getDefaultFont

public static Font getDefaultFont()
Return the system font.

Returns:
current system font object

getHeight

public int getHeight()
return the height of the font in pixels.

Returns:
pixel height

getBaselinePosition

public int getBaselinePosition()
Return the base line position in pixels. This is the offset from the top of the font.

Returns:
base position.

stringWidth

public int stringWidth(String str)
Return the width of the specified string in pixels

Parameters:
str -
Returns:
width of the string

getFont

public static Font getFont(int face,
                           int style,
                           int size)
Request a particular type and size of font. Currently only the size parameter is used and it should be one of SIZE_SMALL, SIZE_MEDIUM or SIZE_LARGE.

Parameters:
face -
style -
size -
Returns:
The requested Font

getSmallFont

public static Font getSmallFont()
Return the small font.

Returns:
the small font

getLargeFont

public static Font getLargeFont()
Return the large font.

Returns:
the large font