com.iproject.wbmpcreator
Class WBMPCustomFont

java.lang.Object
  |
  +--com.iproject.wbmpcreator.WBMPCustomFont

public class WBMPCustomFont
extends java.lang.Object


Field Summary
static int DIRECTION_HORIZONTAL
          A constant value representing horizontal direction of drawing a line.
static int DIRECTION_VERTICAL
          A constant value representing vertical direction of drawing a line.
static int FONT_4X6
          A contant value representing a 4x6 font.
static int FONT_CUSTOM
          A contant value representing a custom font.
 
Constructor Summary
WBMPCustomFont(CustomFont cfont)
          Constructor creating WBMPCustomFont instance from existing CustomFont instance
WBMPCustomFont(java.lang.String fontname)
          Constructor creating WBMPCustomFont instance and loading the specified font.
 
Method Summary
static CustomFont getDefaultFont()
          Method returning built-in 4x6 font instance.
static WBMPfile getWBMPImage(java.lang.String text, int usedFont, int direction)
          A method returning WBMPfile instance containing a string written with the selected font.
 void openUDF(java.lang.String fontname)
          Method to open the User-Defined Font.
 void unloadCustomFont()
          Unload previously loaded CustomFont instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FONT_CUSTOM

public static final int FONT_CUSTOM
A contant value representing a custom font.

FONT_4X6

public static final int FONT_4X6
A contant value representing a 4x6 font. This is the smallest font I've managed to draw.

DIRECTION_VERTICAL

public static final int DIRECTION_VERTICAL
A constant value representing vertical direction of drawing a line. I.e. the first letter will be on the top, the second will follow, etc.

DIRECTION_HORIZONTAL

public static final int DIRECTION_HORIZONTAL
A constant value representing horizontal direction of drawing a line. I.e. the first letter will be to the left, the second will follow, etc.
Constructor Detail

WBMPCustomFont

public WBMPCustomFont(java.lang.String fontname)
               throws java.io.FileNotFoundException
Constructor creating WBMPCustomFont instance and loading the specified font.
Since:
1.30

WBMPCustomFont

public WBMPCustomFont(CustomFont cfont)
Constructor creating WBMPCustomFont instance from existing CustomFont instance
Since:
1.43
Method Detail

getWBMPImage

public static WBMPfile getWBMPImage(java.lang.String text,
                                    int usedFont,
                                    int direction)

A method returning WBMPfile instance containing a string written with the selected font.

If wrong font is specified - the 96x65pixels image is returned.

Parameters:
text - the string to be converted
usedFont - font to be used
direction - the direction of drawing line
Returns:
the WBMPfile instance containing the given string
Since:
1.20

openUDF

public void openUDF(java.lang.String fontname)
             throws java.io.FileNotFoundException
Method to open the User-Defined Font. It first looks for a compiled font (font name + ".udfc") and of possible instantiates the CustomFont class. If compiled font is absent - it tries to open the file with ".udf" extension. If it is also absent - the java.io.FileNotFoundException exception is raised.

Later this font can be used as follows:

 WBMPCustomFont wcf=new WBMPCustomFont();
 WBMPfile wf;
 try{
   wcf.openUDF("my_font");
   wf=wcf.getWBMPImage("MY FONT TEST",wcf.FONT_CUSTOM);
 } catch(Exception e){
 } // try
 
Parameters:
fontname - the name of a font (WITHOUT EXTENSION)

unloadCustomFont

public void unloadCustomFont()
Unload previously loaded CustomFont instance.

getDefaultFont

public static CustomFont getDefaultFont()
Method returning built-in 4x6 font instance.
Returns:
the CustomFont instance for a default font
Since:
1.43