FontMapper version 0.1.0

Introduction

FontMapper is a free/open source font texture generator for game developers written in Java. It allows you to turn a font you have installed to a PNG texture of tightly packed glyphs, accompanied by a text file describing the glyphs' properties and texture coordinates. You can read these quite easily in a game to render fonts. FontMapper supports Unicode (although only the Basic Multilingual Plane, i.e. the 16-bit codepoints), and each glyph can have its own size, i.e. fonts are not necessarily monospaced.

Currently, FontMapper is command-line only, although there might be a GUI frontend in future.

Features

Requirements

Java 6.0 virtual machine (might work, but wasn't tested, on other versions.) Python 2.6 for the launcher script.

Using FontMapper to generate font textures

  fontmapper.py [OPTION...] [FONT]
   -a,--antialiasing <arg>   Antialiasing mode. Can be "none" or "gray". Default:                                                                                                     
                             "gray"                                                                                                                                                   
   -c,--color-format <arg>   Color format of output texture/s. Can be "bitmap",                                                                                                       
                             "gray" or "rgba"Antialiasing does not work with                                                                                                          
                             "bitmap". Default: "gray"
   -e,--end-glyph <arg>      Last unicode index to draw glyph for. Default: 256                                                                                                       
   -g,--gap <arg>            Spacing between glyphs in pixels. Default: 1
   -h,--help                 Print this help message.
   -l,--list-fonts           List available fonts.
   -o,--output <arg>         Base name of output textures and glyph data file.
                             Texture filenames are in format baseXXXX.png, where
                             XXXX is texture number, starting at 0. So e.g. if -o
                             is "font" and glyphs drawn need 3 textures to fot to,
                             their filenames will be font0000.png, font0001.png
                             and font0002.png . Default: font name
   -s,--start-glyph <arg>    First unicode index to draw glyph for. Default: 0
   -S,--font-size <arg>      Font size in points. Default: 16
   -t,--style <arg>          Font style to use. Can be "plain", "italic", "bold"
                             or "bold-italic". Default: "plain"
   -x,--width <arg>          Width of generated texture/s. Default: 256
   -y,--height <arg>         Height of generated texture/s. Default: 256

Example:

./fontmapper -e 65535 -o "Font" -S 9 -x 1024 -y 1024 -t bold-italic "DejaVu Sans"

This will generate a 1024x1024 texture or textures with glyphs 0-65535 of font DejaVu Sans with size 9 and bold-italic style. Glyphs will be antialiased and texture will be 8-bit grayscale, since those are the defaults. Texture and font map filenames will start by Font, e.g. Font_0000.png, Font.fmap.

Rendering fonts using FontMapper generated textures

There is an example C++/SDL/OpenGL project drawing font from FontMapper generated textures in the example/ directory of the distribution. Currently, the example is not well documented, although the code should be readable. This should improve in the future.

I'm planning to release a tutorial on using FontMapper textures as soon as I have time to write it, but it is not available at this time.

License

FontMapper is free/open source software distributed under the Boost license. This license allows you to use FontMapper free of charge and modify it if you want to, without requiring you to open source your modifications.

Full text of the license:

  Boost Software License - Version 1.0 - August 17th, 2003
  
  Permission is hereby granted, free of charge, to any person or organization
  obtaining a copy of the software and accompanying documentation covered by
  this license (the "Software") to use, reproduce, display, distribute,
  execute, and transmit the Software, and to prepare derivative works of the
  Software, and to permit third-parties to whom the Software is furnished to
  do so, all subject to the following:
  
  The copyright notices in the Software and this entire statement, including
  the above license grant, this restriction and the following disclaimer,
  must be included in all copies of the Software, in whole or in part, and
  all derivative works of the Software, unless such copies or derivative
  works are solely in the form of machine-executable object code generated by
  a source language processor.
  
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
  SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
  FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  DEALINGS IN THE SOFTWARE.

Credits

FontMapper Gitorious page: gitorious.org/fmapper/

FontMapper was created by Ferdinand Majerech aka Kiith-Sa kiithsacmp[AT]gmail.com

FontMapper was created with Vim and Eclipse on Debian Linux, as a project for the University of Pavol Joyef Šafárik in Košice, Slovakia


Last update: 04-01-2011