A simple abstraction of platform fonts and library fonts that enables the library to use more elaborate fonts unsupported by a specific device. This abstraction also supports bitmap fonts using an Ant task (more details about the unifier are explained in the javadoc overview document).
A bitmap font can be created manually but that is tedious, normally you would use the Ant task as illustrated bellow to produce a resource file containing the supported bitmap font. For further detail read the overview document and {@link com.sun.lwuit.util.Resources}.
<target name="pre-init"> <taskdef classpath="ImageUnifier.jar" classname="com.sun.jwt.resource.Builder" name="build" /> <build dest="src/font.res"> <font src="images/arial.ttf" bold="true" italic="true" size="11" /> <font logicalName="Dialog" /> </build> </target>
The following attributes can be expressed for a font ant task:
- name - name for the font to load from the resource file (optional: defaults to logical name or file name).
- charset - defaults to the English alphabet, numbers and common signs. Should contain a list of all characters that should be supported by a font. E.g. if a font would always be used for uppercase letters then it would save space to define the charset as: {@code "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }
- src - font file in the case of using a file, defaults to TrueType font
- size - floating point size of the font
- bold - defaults to false indicates if the font should be bold
- italic - defaults to false indicates if the font should be italic
- trueType - defaults to true, relevant only when src is used. If set to false type 1 fonts are assumed.
- antiAliasing - defaults to true otherwise fonts will be aliased
- logicalName - logical name of the font as specified by java.awt.Font in Java SE: {@code Dialog, DialogInput, Monospaced, Serif, or SansSerif }