This Java tip explains the method of creating a BitMapFont in your application. A bitmap font is simply an image that contains character shapes for a font. The bitmap font image is a single line of text containing one of each character shape.

 import de.enough.polish.util.*;

public class MyCanvas extends Canvas {
    private BitMapFont bitMapFont;
    privte BitMapFontViewer messageViewer;
    public MyCanvas() {
        this.bitMapFont = BitMapFont.getInstance("/coolfont.bmf");
        this.messageViewer = this.bitMapFont.getViewer("Hello World!");
        int availableWidth = getWidth() - 20;
        int padding = 2;
        int textOrientation = Graphics.LEFT;
        this.messageViewer.layout( availableWidth, availableWidth, 
                padding, orientation );
    public void paint( Graphics g ) {
        int x = 10;
        int y = 20;
        this.messageViewer.paint( x, y, g );




 Related Tips