FontSample Utility

Usage of FontSample

FontSample can be used to generate font samples in PDF form showing the Unicode coverage of the font similar in appearance to the Unicode charts. Although the ideas of this application are based on <a href="http://fntsample.sourceforge.net>FntSample", developed by Eugeniy Meshcheryakov for use with DejaVu Fonts project, the code is written from scratch in C++ using wxWidgets and wxPdfDocument.

FontSample -f FONTFILE -o OUTPUTFILE [-n FONTINDEX] [-e encoding] [-i RANGES] [-x RANGES]

FontSample -h

-f FONTFILEThe font file for which a sample should be generated. It can be the name of a TrueType, OpenType or Type1 font file, but wxPdfDocument's font description files are supported, too.
-o OUTFILEThe file to which the PDF output is written. Usually it should have the extension .pdf.
-n INDEX

The index of the font within the FONTFILE in case of TrueType Collections (.ttc) which contain multiple fonts. By default font with index 0 is used.

-e ENCODING

the font encoding of the font. This option is required only for Type1 fonts and is ignored for other font types.

The encoding defines the association between a code (from 0 to 255) and an Unicode character. The first 128 are fixed and correspond to ASCII; the next 128 are variable. The following encodings are supported by FontSample:

  • standard ()
  • winansi ()
  • macroman ()
  • symbol ()
  • zapfdingbats ()
  • cp-1250 (Central Europe)
  • cp-1251 (Cyrillic)
  • cp-1252 (Western Europe)
  • cp-1253 (Greek)
  • cp-1254 (Turkish)
  • cp-1255 (Hebrew)
  • cp-1256 ()
  • cp-1257 (Baltic)
  • cp-1258 (Vietnamese)
  • cp-874 (Thai)
  • cp-932 ()
  • cp-936 ()
  • cp-949 ()
  • cp-950 ()
  • iso-8859-1 (Western Europe)
  • iso-8859-2 (Central Europe)
  • iso-8859-3 ()
  • iso-8859-4 (Baltic)
  • iso-8859-5 (Cyrillic)
  • iso-8859-6 ()
  • iso-8859-7 (Greek)
  • iso-8859-8 ()
  • iso-8859-9 (Turkish)
  • iso-8859-10 ()
  • iso-8859-11 (Thai)
  • iso-8859-13 ()
  • iso-8859-14 ()
  • iso-8859-15 (Western Europe)
  • iso-8859-16 (Central Europe)
  • koi8-r (Russian)
  • koi8-u (Ukrainian)
-i RANGESShow character codes in RANGES.
-x RANGES

Don't show character codes in RANGES.

-h | --helpDisplay a usage information and exit.

if 0

Parameter RANGE for --include-range and --exclude-range can be given as one integer or a pair of integers delimited by minus sign (-). Integers can be specified in decimal, hexadecimal (0x...) or octal (0...) format. One integer of a pair can be missing (-N can be used to specify all characters with codes less or equal to N, and N- for all characters with codes greater or equal to N). Multiple --include-range and --exclude-range options can be used. Colors¶

Glyph cells can have one of several background colors. Meaning of those colors is following:

white — normal glyph present in the font, this includes space glyphs that are usually invisible; gray — this glyph is defined in Unicode but not present in the font; blue — this is a control character; black — this glyph is not defined in Unicode; yellow — this is a new glyph (only when used with --other-font).

Examples¶

Make PDF samples for font.ttf and write them to file samples.pdf:

fntsample -f font.ttf -o samples.pdf

Make PDF samples for font.ttf, compare it with oldfont.ttf and highlight new glyphs. Write output to file samples.pdf:

fntsample -f font.ttf -d oldfont.ttf -o samples.pdf

Make PostScript samples for font.ttf and write output to file samples.ps. Show only glyphs for characters with codes less then or equal to U+04FF but exclude U+0370-U+03FF:

fntsample -f font.ttf -s -o samples.ps -i -0x04FF -x 0x0370-0x03FF

Make PDF samples for font.ttf and save output to file samples.pdf adding outlines to it:

fntsample -f font.ttf -o temp.pdf -l > outlines.txt pdfoutline temp.pdf outlines.txt samples.pdf

endif

/**