Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

84 lines (62 sloc) 3.051 kB
=====================
Font Generation Guide
=====================
Audience
--------
This guide is for translators or developers interested in adding
automatically generated Frogatto font textures so that it can support a
new language, or updating an existing font texture to reflect changes
to a translation.
Background
----------
Currently Frogatto uses, instead of TrueType or fonts in other common
formats, bitmap font textures -- images containing the rendering of
each character, plus FML files describing the location of each glyph in
the image.
Frogatto uses four groups of fonts: numbers, dialog, label and
outline, where "number" is used for floating number popups, score and
coin amounts, "dialog" for dialog lines, "label" for button labels,
and "outline" mainly for the title screen tips. The font generation
system only deals with the latter three, and refers to them as "styles".
The "number" font is not included in the automatic generation because
it can be usually reused in any language.
The reason why an automatic font texture generation system is needed
is because certain languages, such as Chinese and Japanese, have huge
"alphabets", so it is infeasible to manually draw all the characters
for them within a short amount of time.
Requirements
------------
The system requires a *nix environment, Ruby 1.9, and ImageMagick.
Usage
-----
The font generation system should be used when a new language with
a huge alphabet is added, or when the translation for an existing
such language is updated. In either case, the system only requires
access to a TrueType font and the po file for the language.
Before using the system, it may be needed to edit the top section of
Rakefile.fonts, to specify fonts used in each language.
To use the system, simply run::
rake fonts
Which will perform all the needed tasks based on the configured
languages. You can also selectively run tasks; use the following
to see how::
rake -T
Implementation
--------------
The system mainly works in three steps: extracting a list of characters,
generating a glyph image for each character, and generating a font
texture. The first step is done for each language, while the next two
steps are done for each language and font style.
This is a "make" like system, which avoids repeating completed work by
checking the modification timestamps of existing files. For example,
if a translation is updated and uses 5 new characters, then only the
glyphs for these characters will be generated and the font texture will
be generated. To force regeneration of a file, delete the file, or "touch"
one of its dependent files, before running the system.
The files used or generated by the system are listed below, in an order
showing their inter-dependencies:
* po/<locale>.po: translation file
* tmp/fonts/<locale>/characters.txt: list of characters
* tmp/fonts/<locale>/{dialog,outline,label}/<codepoint>.png: glyph image
* images/gui/{dialog,outline,label}_font.<locale>.png: font texture
* data/fonts.<locale>.cfg: glyph location data
Jump to Line
Something went wrong with that request. Please try again.