This is the official tool for building font files (.alf & .ali) for AlbiteREADER.
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
nbproject
src
tools
.gitignore
build.xml
manifest.mf
readme.markdown

readme.markdown

Usage

Just run it from within the directory containing the images (*.png) and the metrics data (*.xml) and it will automatically produce the *.alf and *.ali files.

java -jar AlbiteFontBuilder-0.9.1

Notes:

  1. For the images containing the glyphs apply the same requirements as the ones mentioned in AlbiteImageConverter's reademe. See it's readme for more info.
  2. The xml file has some specific structure, too. It's almost identical to the one, produced by Angel Code's Bitmap font generator. See next section for instructions

The *.xml metrics file

Here goes an example of how should a file of this king look like:

<font lineSpacing="0" lineHeight="18">
    <char id="32" x="12" y="26" width="1" height="1" xoffset="0" yoffset="14" xadvance="4" />
    <char id="35" x="9" y="40" width="8" height="11" xoffset="0" yoffset="3" xadvance="8" />
    <char id="37" x="0" y="16" width="12" height="12" xoffset="0" yoffset="3" xadvance="13" />
    <char id="40" x="16" y="0" width="4" height="14" xoffset="0" yoffset="2" xadvance="5" />
    <char id="41" x="20" y="0" width="4" height="14" xoffset="0" yoffset="2" xadvance="5" />
    <char id="45" x="8" y="14" width="4" height="2" xoffset="0" yoffset="9" xadvance="4" />
    <char id="46" x="30" y="26" width="2" height="3" xoffset="1" yoffset="12" xadvance="4" />
    <char id="47" x="1" y="0" width="5" height="14" xoffset="0" yoffset="2" xadvance="4" />
    <char id="48" x="12" y="14" width="7" height="12" xoffset="0" yoffset="3" xadvance="8" />
    <char id="49" x="17" y="38" width="7" height="11" xoffset="1" yoffset="3" xadvance="8" />
    <char id="50" x="24" y="38" width="7" height="11" xoffset="0" yoffset="3" xadvance="8" />
    <char id="51" x="19" y="14" width="7" height="12" xoffset="0" yoffset="3" xadvance="8" />
    <char id="52" x="0" y="40" width="9" height="11" xoffset="0" yoffset="3" xadvance="8" />
    <char id="53" x="0" y="28" width="7" height="12" xoffset="0" yoffset="3" xadvance="8" />
    <char id="54" x="7" y="28" width="7" height="12" xoffset="1" yoffset="3" xadvance="8" />
    <char id="55" x="0" y="51" width="7" height="11" xoffset="1" yoffset="3" xadvance="8" />
    <char id="56" x="14" y="26" width="7" height="12" xoffset="0" yoffset="3" xadvance="8" />
    <char id="57" x="21" y="26" width="7" height="12" xoffset="0" yoffset="3" xadvance="8" />
    <char id="58" x="28" y="26" width="2" height="10" xoffset="1" yoffset="5" xadvance="4" />
    <char id="60" x="7" y="51" width="7" height="8" xoffset="1" yoffset="5" xadvance="8" />
    <char id="62" x="14" y="51" width="7" height="8" xoffset="1" yoffset="5" xadvance="8" />
    <char id="63" x="26" y="14" width="6" height="12" xoffset="0" yoffset="3" xadvance="7" />
    <char id="91" x="24" y="0" width="4" height="14" xoffset="1" yoffset="2" xadvance="5" />
    <char id="93" x="28" y="0" width="4" height="14" xoffset="0" yoffset="2" xadvance="5" />
    <char id="95" x="1" y="14" width="7" height="2" xoffset="0" yoffset="15" xadvance="7" />
    <char id="123" x="6" y="0" width="5" height="14" xoffset="0" yoffset="2" xadvance="6" />
    <char id="124" x="0" y="0" width="1" height="16" xoffset="3" yoffset="2" xadvance="8" />
    <char id="125" x="11" y="0" width="5" height="14" xoffset="0" yoffset="2" xadvance="6" />
    <char id="183" x="21" y="49" width="2" height="3" xoffset="1" yoffset="7" xadvance="4" />
</font>

Notes:

  1. The lineSpacing and lineHeight attributes of the font tag are obligatory.
  2. All fonts must include these obligatory characters: 32 (space), 45 (dash) and 63 (question mark) or the building would fail.

The Binary Font Metrics Descriptor File (*.alf)

Main overview

Meaning Type Bytes
Magic number Integer 4
Line spacing Byte 1
Line height Byte 1
Largest ID in the font Integer 4
Maximum character width Short 2
Number of characters Integer 4
Character metrics blocks Block of several values 18 * number of characters

Character block

Meaning Type Bytes
ID Integer 4
x-coordinate Short 2
y-coordinate Short 2
width Short 2
height Short 2
x-offset Short 2
y-offset Short 2
advance on x Short 2