Font2Texture ============ v0.1 (2005-03-23) This tool lays out glyphs from outline fonts onto a single bitmap. This is useful for apps (games mostly) which compose text by arranging subimages sourced from a larger bitmap. For example, opengl or d3d games often render text strings as a set of quads (with one letter on each successive quad), using the font bitmap as the source texture. 2D games often compose text strings by blitting the character images one at a time from the source bitmap to the screen. Font2Texture supports any outline font format supported by the freetype2 library (http://www.freetype.org): * TrueType fonts (and collections) * Type 1 fonts * CID-keyed Type 1 fonts * CFF fonts * OpenType fonts (both TrueType and CFF variants) * SFNT-based bitmap fonts * X11 PCF fonts * Windows FNT fonts * BDF fonts (including anti-aliased ones) * PFR fonts * Type42 fonts (limited support) The resulting image is written out as a png file with or without an alpha channel, depending on settings. A corresponding .fontdata file is also saved. This is a text file which describes where font glyphs reside on the png image. Compiling --------- Requires: freetype2, wxWidgets 2.4+, libpng The included Makefile is pretty rudimentary, but works for me on Linux (debian) and Windows (using mingw and msys). YMMV. .fontdata format ---------------- Lines beginning with a hash (#) are comments. ascender max distance from baseline to top of tallest character in the font (in pixels) begin the ascii code of the first glyph numglyphs the number of glyphs defined. Each glyph is then defined using the following format: glyph imgx, imgy, imgw, imgh define the glyph rectange within the texture. bitmap_left and bitmap_top indicate where the glyph rectange should be drawn relative to the current pen position. bitmap_left is the horizontal distance from the current pen position to the leftmost border of the glyph rectange. bitmap_top is the vertical distance from the pen position (on the baseline) to the topmost border of the glyph rectange. It is positive to indicate an upwards distance. advancex is how much to add to the pen x position after drawing this glyph. All values in pixels.