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 FONTFILE | The 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 OUTFILE | The 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:
|
-i RANGES | Show character codes in RANGES. |
-x RANGES | Don't show character codes in RANGES. |
-h | --help | Display 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
/**