ttf2png - True Type Font to PNG converter
-Copyright (c) 2004-2008 Mikko Rasa, Mikkosoft Productions
+Copyright (c) 2004-2018 Mikko Rasa, Mikkosoft Productions
Software requirements
FreeType 2
-libpng 1.2
+libpng 1.6
C compiler (preferably GCC)
Command-line options
-r <low>,<high>
- Range of characters to convert, specified as unicode code points. The
+ Range of code points to convert, specified as unicode code points. The
default is 0,255, matching the ISO-8859-1 (Latin-1) character set.
-s <pixels>
Font size to use. The default is 10 pixels.
-l <num>
- Number of characters to put in one line. Defaults to autodetect. Ignored
+ Number of glyphs to put in one line. Defaults to autodetect. Ignored
if -p is used.
-c <pixels>[x<pixels>]
-i
Invert colors of the glyphs. When rendering to alpha channel, only the
- alpha channel is inverted.
+ alpha channel is inverted. The default is to render black glyphs on a
+ white background.
-v
Increase the level of verbosity.
each glyph is determined by its code point. Ignored if -p is used.
-p
- Pack the glyphs tightly in the image. One-pixel gaps are left between
- glyphs. By default glyphs are rendered in a regular grid. Creating a
- definition file is recommended, as the resulting image can seem rather
- messy.
+ Pack the glyphs tightly in the image. Small gaps are left between glyphs,
+ controlled by the -n option. By default glyphs are rendered in a regular
+ grid. Creating a definition file is recommended, as the resulting image
+ can seem rather messy.
-m <pixels>
Leave a margin around the edges of the generated image. By default glyphs
Image image;
} Font;
-void usage();
+void usage(void);
unsigned round_to_pot(unsigned);
void *alloc_image_data(size_t, size_t);
int init_font(Font *, FT_Face, unsigned, unsigned, int);
return 0;
}
-void usage()
+void usage(void)
{
printf("ttf2png 1.1 - True Type Font to PNG converter\n"
- "Copyright (c) 2004-2008 Mikko Rasa, Mikkosoft Productions\n"
+ "Copyright (c) 2004-2018 Mikko Rasa, Mikkosoft Productions\n"
"Distributed under the GNU General Public License\n\n");
printf("Usage: ttf2png [options] <TTF file>\n\n");
printf("Accepted options (default values in [brackets])\n"
- " -r Range of characters to convert [0,255]\n"
+ " -r Range of code points to convert [0,255]\n"
" -s Font size to use, in pixels [10]\n"
- " -l Number of characters to put in one line [auto]\n"
- " -c Character cell size, in pixels [auto]\n"
+ " -l Number of glyphs to put in one line [auto]\n"
+ " -c Glyph cell size, in pixels (grid mode only) [auto]\n"
" -o Output file name (or - for stdout) [font.png]\n");
printf(" -a Force autohinter\n"
" -t Render glyphs to alpha channel\n"
" -i Invert colors of the glyphs\n"
" -v Increase the level of verbosity\n"
- " -e Use cells in sequence, without gaps\n"
+ " -e Use cells in sequence, without gaps (grid mode only)\n"
" -p Pack the glyphs tightly instead of in a grid\n"
- " -m Margin around image edges in packed mode [0]\n"
- " -n Padding between packed glyphs [1]\n"
+ " -m Margin around image edges (packed mode only) [0]\n"
+ " -n Padding between glyphs (packed mode only) [1]\n"
" -d File name for writing glyph definitions\n"
" -h Print this message\n");
}