5.6. fontcreator

5.6.1. Commandline Options

Usage: fontcreator.py [options]

Options:
  -h, --help            show this help message and exit
  -i FILE, --input=FILE
                        The input font (.fontinfo)
  -o FILE, --output=FILE
                        The output font (.fntb)
  -d DIRECTORY, --datadir=DIRECTORY
                        The data directory that all resource paths should be
                        relative to
  -e ENDIAN, --endian=ENDIAN
                        The endianess of the output file.
  -v, --verbose         Specifies verbose mode
  -l LOG, --log=LOG     A log file where the stdout is saved logged to.
  -w TEXT, --writetext=TEXT
                        When used, a .fontinfo file is used as input and the
                        text is written into the output texture.
  --bgcolor=COLOR       The background color used when writing text

5.6.2. Reference

Copyright @ 2013 Mathias Westerdahl

class fontcreator.Glyph(utf8, unicode)[source]

Holds the glyph info. For a detailed description of the glyph metrics, see http://www.freetype.org/freetype2/docs/tutorial/step2.html

Parameters:
  • utf8 – The UTF-8 character code
  • unicode – The unicode letter
  • bitmap – The numpy array of shape (x, y, 4)
  • bitmapbox – The box in the texture where the glyph is printed. A 4-tuple: (left, top, width, height) (In pixels)
  • bearingX – The distance from the cursor to the leftmost border of the bitmap
  • bearingY – The distance from the baseline to the topmost border of the bitmap
  • advance – The distance used to increment the cursor
fontcreator.write_text(options, info, pairkernings)[source]

Writes the given text to an image