palmed.edit
Class MonospacedFont

java.lang.Object
  extended by palmed.edit.MonospacedFont
All Implemented Interfaces:
IFont

public final class MonospacedFont
extends java.lang.Object
implements IFont

This class implements a custom monospaced bitmap font.

The only image format supported is png.

Version:
$Revision: 395 $ $Date: 2005-12-31 13:05:41 +0900 (sam., 31 déc. 2005) $
Author:
Mathieu Champlon

Constructor Summary
MonospacedFont(java.lang.String name)
          Create a monospaced font.
 
Method Summary
 void draw(javax.microedition.lcdui.Graphics g, java.lang.String text, int start, int end, int y)
          Draw the given characters.
 void drawEmptySelection(javax.microedition.lcdui.Graphics g, int start, int end, int y)
          Draw the given number of spaces as selection.
 void drawSelection(javax.microedition.lcdui.Graphics g, java.lang.String text, int start, int end, int y)
          Draw the given characters as selection.
 int getHeight()
          Retrieve the height of a character.
 int getWidth()
          Retrieve the width of a character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonospacedFont

public MonospacedFont(java.lang.String name)
Create a monospaced font.

Parameters:
name - the font bitmap filename
Method Detail

getWidth

public int getWidth()
Retrieve the width of a character.

Specified by:
getWidth in interface IFont
Returns:
character width in pixels

getHeight

public int getHeight()
Retrieve the height of a character.

Specified by:
getHeight in interface IFont
Returns:
character height in pixels

draw

public void draw(javax.microedition.lcdui.Graphics g,
                 java.lang.String text,
                 int start,
                 int end,
                 int y)
Draw the given characters.

The character at the end position should not be drawn.

Specified by:
draw in interface IFont
Parameters:
g - the graphics to use
text - the text to draw a subpart of
start - the start position in the text
end - the end position in the text
y - the line number to draw the text at

drawSelection

public void drawSelection(javax.microedition.lcdui.Graphics g,
                          java.lang.String text,
                          int start,
                          int end,
                          int y)
Draw the given characters as selection.

The character at the end position should not be drawn.

Specified by:
drawSelection in interface IFont
Parameters:
g - the graphics to use
text - the text to draw a subpart of
start - the start position in the text
end - the end position in the text
y - the line number to draw the text at

drawEmptySelection

public void drawEmptySelection(javax.microedition.lcdui.Graphics g,
                               int start,
                               int end,
                               int y)
Draw the given number of spaces as selection.

The character at the end position should not be drawn.

Specified by:
drawEmptySelection in interface IFont
Parameters:
g - the graphics to use
start - the start position in the text
end - the end position in the text
y - the line number to draw the text at


Copyright © 2004-2006 PalmEd. All Rights Reserved.