Cube2font - Hirato/lamiae GitHub Wiki

Cube2Font is a cube 2 utility which is bundled with Lamiae. Build rules currently only exist for POSIX systems via the Makefile, but building should be trivial as long as you have a standard C library and compiler available, as well as the freetype library.

Cube 2 uses its own internal character set, which consists of 128 ASCII characters and a wide amalgamation of international characters which make up the other 128 entries. Cube 2 doesn't use UTF-8 or UTF-16 at all, but converts to and from UTF-8 when writing text files.

Usage: cube2font infile outfile outborder[:inborder] pad offset advance charwidth charheight texwidth texheight [spacewidth spaceheight texdir]

infile This refers to the path of a ttf font which is to be converted to a compatible bitmap font.

outfile Refers to the name of the output file, slashes will be translated into directory separators. This takes no extension, the extensions (.cfg and .png) are generated automatically.

outborder:[inborder] The text is rendered as pure white, the border is drawn as black. The size is specified in pixels and outborder refers to the border around the glyph and inborder encroaches into the glyph itself. Unless you intend to take advantage of fontscale, we recommend the values 3:0

pad This is empty and unused pixels between characters. Due to the way bi/tri/whatever filtering works, you will want this to be at least 2, otherwise the characters will bleed into each other.

offset (Unverified) Applies vertical and horizontal offsets to each character, essentially moving them extra far horizontally and vertically when displayed

advance (Unverified) Applies a horizontal offset, given text extra horizontal spacing between characters.

charwidth and charheight These two variables define the width and height of each character. You will generally want this to be in a 1 to 1 ratio, like 32x32. Unless you intend to make use of fontscale, we would recommend the values 49 49 for these parameters. Using non 1:1 values may cause stretching, clipping, and other issues.

texwidth and texheight These define the dimensions of the output's destination surface. Dimensions of 512x512 are suggested, as most fonts will take up 2 of these surfaces. If yours takes up 4, perhaps because you intend to make use of fontscale to have higher resolution text. No safety checks or limits are enforced, but 4096x4096 should be considered the limit, and you should try to limit yourself to 1024x1024.

spacewidth and spaceheight These default to 0, we would recommend giving them the values 64 32. The values are automatically generated and filled in when absent. The height will be set to the average height of each character, and the width to a third of that, which will be undesirable for certain fonts.

texdir This is the path in which the output configuration file will reference the font textures. With Lamiae you will want this set to packages/fonts/ (with the slash) unless you want to fix the script up before it can be used.