Main
downloads
encodings
Simplified fonts

This program extracts concrete outline fonts from .ttf file format and saves them as sequence of raw alpha maps (or raw bits maps). Output file contains information about first and last character code, width and height of each sign (in pixels) and raw signs without information about kerning and other subtleties.

example of use:
>sf +f fonts.ttf +from 65 +to 90 +s 32 +o outputFile

switches description:
+f <file name> (input .ttf file)
+fi <index> (index of fonts face, default is 0)
+from <Character code> (starting character code, default is 32)
+to <Character code> (ending character code, default is 126)
+s <size> (scaling rendered fonts for specific size, default is 16)
+enc <name> (name of encoding composed of four letters, default is "unic")
-vs_info (this stand-alone switch turns off saving vertical shifts informations , default is turned on)
+o <file name> (output file, default is "out")
+all (this stand-alone switch turns on processing all characters codes even if they don't exist in .ttf file, without warning, default is turned off)
+bm <color(0..255)> (turns on mono mode with converting alpha pixels which are greater or equal than specified color to bits map)
+help or --help (printing help screen)


Format of output file is as simple as possible:

header:
struct SFHeader {
  char encoding[ 4 ]; //name of characters encoding (for 'from' and 'to' character code)
  unsigned int from, to; //embracing characters codes
  unsigned char info; // first bit is set if there are informations about vertical shifts, second bit is set if mono mode is turned on
};

metric of sign:
struct Metric {
  unsigned char width, height; //max width and height is 255 pixels
};

Vertical shift (exist in file if first bit is set in header's info ):
Vertical shift for each sign tells how many rows of pixels have to be added to the top of sign's alpha map, so that signs will be on the same horizontal baseline (if that alpha maps are drawn from top to bottom from the same Y coordinate). Vertical shift is stored as unsigned char, directly after metric.

Raw alpha map (or raw bits map if second bit is set in header's info):
Visual image of sign on specified size. Each pixel is stored on unsigned char (0..255) and tells information about opacity for alpha channel.



Glossary

Kerning: process of adjusting the position of two subsequent font images in a string of text in order to improve the general appearance of text. Basically, it means that when the sign for an ‘A’ is followed by the sign for a ‘V’, the space between them can be slightly reduced to avoid extra ‘diagonal whitespace’.

Outline font: mathematical description of lines and curves for making visual image of sign in specific size.

Character code: defines the character for a given encoding.

Charmaps: tables that are used to convert character codes to sign indices.

Face: style of fonts, for example, ‘Times New Roman Regular’ and ‘Times New Roman Italic’ correspond to two different faces.

Alpha map: each pixel is represented by one number (usually 0..255), which is used for alpha channel.

Alpha channel: reserved for opacity color.

Hosted by www.Geocities.ws

1