Utilities » Font conversion utility

Converts font to raster one of given atlas size.

This utility is built if both WITH_TEXT and WITH_FONTCONVERTER is enabled when building Magnum. To use this utility with CMake, you need to request the fontconverter component of the Magnum package and use the Magnum::fontconverter target for example in a custom command:

find_package(Magnum REQUIRED fontconverter)

add_custom_command(OUTPUT ... COMMAND Magnum::fontconverter ...)

See Downloading and building, Usage with CMake and the Text namespace for more information.

Usage

magnum-fontconverter [--magnum-...] [-h|--help] --font FONT
    --converter CONVERTER [--plugin-dir DIR] [--characters CHARACTERS]
    [--font-size N] [--atlas-size "X Y"] [--output-size "X Y"] [--radius N]
    [--] input output

Arguments:

  • input — input font
  • output — output filename prefix
  • -h, --help — display help message and exit
  • --font FONT — font plugin
  • --converter CONVERTER — font converter plugin
  • --plugin-dir DIR — override base plugin dir
  • --characters CHARACTERS — characters to include in the output (default: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!:;,. )
  • --font-size N — input font size (default: 128)
  • --atlas-size "X Y" — glyph atlas size (default: "2048 2048")
  • --output-size "X Y" — output atlas size. If set to zero size, distance field computation will not be used. (default: "256 256")
  • --radius N — distance field computation radius (default: 24)
  • --magnum-... — engine-specific options (see Command-line options for details)

The resulting font files can be then used as specified in the documentation of converter plugin.

Example usage

Making raster font from TTF file with default set of characters using FreeTypeFont font plugin and MagnumFontConverter converter plugin:

magnum-fontconverter --font FreeTypeFont --converter MagnumFontConverter DejaVuSans.ttf myfont

According to MagnumFontConverter plugin documentation, this will generate files myfont.conf and myfont.tga in current directory. You can then load and use them via the MagnumFont plugin.