Go to the first, previous, next, last section, table of contents.


The plotfont Utility

How to use plotfont

GNU plotfont is a simple utility that will produce a character map for any font available to the GNU plotting utilities graph, plot, pic2plot, and tek2plot, and the GNU libplot graphics library on which they are based. The map may be displayed on an X Window System display, or produced in any of several output formats. The `-T' option is used to specify the desired output format. Supported output formats include "X", "pnm", "gif", "ai", "ps", "fig", "pcl", "hpgl", "tek", and "meta" (the default).

Which fonts are available depends on the choice of display or output format. To get a list of the available fonts, use the `--help-fonts' option. For example,

plotfont -T ps --help-fonts

will list the fonts that are available when producing Postscript output. One of these fonts is "Times-Roman". Doing

plotfont -T ps Times-Roman > map.ps

will produce a character map of the lower half of this font, which consists of printable ASCII characters. The map will be a 12x8 grid, with a character centered in each grid cell. If you include the `-2' option, you will get a map of the upper half of the font.

Most built-in fonts are ISO-Latin-1 fonts, which means that the upper half is arranged according to the ISO-Latin-1 encoding. The "HersheyCyrillic" font is one that is not. If you do

plotfont -T ps -2 HersheyCyrillic > map.ps

you will get a map that illustrates its arrangment, which is called KOI8-R. The KOI8-R arrangement is the standard for Unix and networking applications in the former Soviet Union. So-called dingbats fonts, such as "ZapfDingbats" and "Wingdings", also have an individualistic layout. In most installations of the plotting utilities, the Wingdings font is not available when producing Postscript output. However, it is available when producing output in PCL 5 or HP-GL/2 format. If you do

plotfont -T hpgl Wingdings > map.plt

you will get a Wingdings character map, in HP-GL/2 format, that may be imported into any application that understands HP-GL/2. Similarly, plot -T pcl Wingdings will produce a Wingdings character map in PCL 5 format, which may be printed on a LaserJet or other PCL 5 device.

In all, more than a hundred fonts are built into the plotting utilities. See section Available text fonts. Actually, if you are using the plotting utilities to display output on an X display, you are not restricted to the built-in fonts. Doing

plotfont -T X --help-fonts

produces a list of the built-in fonts that are available, including both Hershey and Postscript fonts. But fonts available on your X display may also be used. The xlsfonts command will list the fonts available on your X display, most font names being given in what is called XLFD format. The plotting utilities refer to X fonts by shortened versions of their XLFD names. For example, the font "Utopia-Regular" is available on many X displays. Its XLFD name is "-adobe-utopia-medium-r-normal--0-0-0-0-p-0-iso8859-1", and its shortened XLFD name is "utopia-medium-r-normal". If you do

plotfont -T X utopia-medium-r-normal

then a character map for this font will be displayed in a popped-up X window.

When using the `-T X' option, you may also use the `--bitmap-size' option to choose the size of the popped-up window. Modern X displays can scale fonts by different amounts in the horizontal and vertical directions. If, for example, you add `--bitmap-size 600x300' to the above command line, both the character map and the Utopia-Regular font within it will be scaled in this way. If your X display does not support font scaling, a scalable font will be substituted.

plotfont command-line options

The plotfont font display utility will produce a character map for any of the fonts available to the GNU plotting utilities graph, plot, pic2plot, and tek2plot, and the GNU libplot graphics library on which they are based. The map may be produced in any supported output format, or displayed on an X Window System display. The output format or display type is specified with the `-T' option.

The names of the fonts for which a character map will be produced may appear anywhere on the plotfont command line. That is, the relative order of font names and command-line options does not matter. The character map is written to standard output, unless the `-T X' option is specified. In that case the character map is displayed in a window on an X Window System display, and there is no output file.

The possible options are listed below. There are three sorts of option:

  1. General options.
  2. Options relevant only to raw plotfont, i.e., relevant only if no display type or output format is specified with the `-T' option.
  3. Options requesting information (e.g., `--help').

Each option that takes an argument is followed, in parentheses, by the type and default value of the argument.

The following are general options.

`-1'
`--lower-half'
Generate a character map for the lower half of each specified font. This is the default.
`-2'
`--upper-half'
Generate a character map for the upper half of each specified font.
`-o'
`--octal'
Number the characters in octal rather than in decimal (the default).
`-x'
`--hexadecimal'
Number the characters in hexadecimal rather than in decimal (the default).
`--box'
Surround each character with a box, showing its extent to left and right. The default is not to do this.
`-j row'
`--jis-row row'
Generate a character map for row row of a Japanese font arranged according to JIS [Japanese Industrial Standard] X0208. The only such font currently available is the HersheyEUC [Extended Unix Code] font. If used, this option overrides the `-1' and `-2' options. The valid rows are 1...94. In the JIS X0208 standard, Roman characters are located in row 3, and Japanese syllabic characters (Hiragana and Katakana) are located in rows 4 and 5. Greek and Cyrillic characters are located in rows 6 and 7. Japanese ideographic characters (Kanji) are located in rows 16...84. Rows 16...47 contain the JIS Level 1 Kanji, which are the most frequently used. They are arranged according to On (old Chinese) reading. Rows 48...84 contain the less frequently used JIS Level 2 Kanji. The HersheyEUC font contains 596 of the 2965 Level 1 Kanji, and seven of the Level 2 Kanji. It uses the 8-bit EUC-JP encoding. This encoding is a multibyte encoding that includes the ASCII character set as well as the JIS X0208 characters. It represents each ASCII character in the usual way, i.e., as a single byte that does not have its high bit set. Each JIS X0208 character is represented as two bytes, each with the high bit set. The first byte contains the row number (plus 32), and the second byte contains the character number.
`-T type'
`--display-type type'
(String, default "meta".) Select a display type or output format of type type, which may be one of the strings "X", "pnm", "gif", "ai", "ps", "fig", "pcl", "hpgl", "tek", and "meta". These refer respectively to the X Window System, portable anymap (PBM/PGM/PPM) format, pseudo-GIF format, the format used by Adobe Illustrator, idraw-editable Postscript, the format used by the xfig drawing editor, the Hewlett--Packard PCL 5 printer language, the Hewlett--Packard Graphics Language (by default, HP-GL/2), Tektronix format, and device-independent GNU graphics metafile format. Files in PNM, pseudo-GIF, AI, or Fig format may contain only a single page of graphics. So if the `-T pnm' option, the `-T gif' option, the `-T ai' option, or the `-T fig' option is used, a character map will be produced for only the first-specified font.
`--bg-color name'
(String, default "white".) Set the color used for the background to be name. This is relevant only to plotfont -T X, plotfont -T pnm, and plotfont -T gif. An unrecognized name sets the color to the default. For information on what names are recognized, see section Specifying Colors by Name. The environment variable BG_COLOR can equally well be used to specify the background color. If the `-T gif' option is used, a transparent pseudo-GIF may be produced by setting the TRANSPARENT_COLOR environment variable to the name of the background color. See section Environment variables.
`--bitmap-size bitmap_size'
(String, default "570x570".) Set the size of the graphics display in which the plot will be drawn, in terms of pixels, to be bitmap_size. This is relevant only to plotfont -T X, plotfont -T pnm, and plotfont -T gif, for which the graphics display size can be expressed in terms of pixels. The environment variable BITMAPSIZE can equally well be used to specify the size. The graphics display used by plotfont -T X is an X window. If you choose a rectangular (non-square) window size, the fonts in the plot will be scaled anisotropically, i.e., by different factors in the horizontal and vertical direction. This requires an X11R6 display. Any font that cannot be scaled in this way will be replaced by a default scalable font, such as the Hershey vector font "HersheySerif". For backward compatibility, the X resource Xplot.geometry, which can be set by the user, may be used to set the window size, instead of `--bitmap-size' or BITMAPSIZE.
`--numbering-font-name font_name'
(String, default "Helvetica" except for plotfont -T pnm, plotfont -T gif, plotfont -T pcl, plotfont -T hpgl and plotfont -T tek, for which "HersheySerif" is the default.) Set the font used for the numbering of the characters in the character map(s) to be font_name.
`--page-size pagesize'
(String, default "letter".) Set the size of the page for which the character map(s) will be produced. This is relevant only to plotfont -T ai, plotfont -T ps, plotfont -T fig, plotfont -T pcl and plotfont -T hpgl. "letter" means an 8.5in by 11in page. Any ISO page size in the range "a0"..."a4" or ANSI page size in the range "a"..."e" may be specified ("letter" is an alias for "a" and "tabloid" is an alias for "b"). "legal", "ledger", and "b5" are recognized page sizes also. The environment variable PAGESIZE can equally well be used to specify the page size. For plotfont -T ai and plotfont -T ps, the graphics display within which each character map is drawn will be a square region centered on the specified page, occupying its full width (with allowance being made for margins). For plotfont -T fig, it will be a square region of the same size, located in the upper left corner of an xfig display. For plotfont -T pcl and plotfont -T hpgl, the graphics display will be a square region of the same size, but may be positioned differently. Fine control over its positioning on the page can be accomplished by setting certain environment variables (see section Environment variables).
`--pen-color name'
(String, default "black".) Set the pen color to be name. An unrecognized name sets the pen color to the default. For information on what color names are recognized, see section Specifying Colors by Name.
`--rotation angle'
(Integer, default 0.) Set the rotation angle of the character map(s) within the graphics display to be angle degrees. Recognized values are 0, 90, 180, and 270. The rotation is counterclockwise. This option is used for switching between portrait mode and landscape mode. Postmodernists may also find it useful.
`--title-font-name font_name'
(String) Set the font used for the title of each character map to be font_name. Normally the font used for the title is the same as the font whose character set is being displayed. This option is useful when producing character maps for unusual fonts such as "ZapfDingbats" and "Wingdings".

The following option is relevant only to raw plotfont, i.e., relevant only if no display type or output format is specified with the `-T' option. In this case plotfont outputs a graphics metafile, which may be translated to other formats by invoking plot.

`-O'
`--portable-output'
Output the portable (human-readable) version of GNU metafile format, rather than a binary version (the default). This can also be requested by setting the environment variable META_PORTABLE to "yes".

The following options request information.

`--help'
Print a list of command-line options, and then exit.
`--help-fonts'
Print a table of available fonts, and then exit. The table will depend on which display type or output format is specified with the `-T' option. plotfont -T X, plotfont -T ai, plotfont -T ps, and plotfont -T fig each support the 35 standard Postscript fonts. plotfont -T ai, plotfont -T pcl, and plotfont -T hpgl support the 45 standard PCL 5 fonts, and plotfont -T pcl and plotfont -T hpgl support a number of Hewlett--Packard vector fonts. All of the preceding, together with plotfont -T pnm, plotfont -T gif, and plotfont -T tek, support a set of 22 Hershey vector fonts. Raw plotfont in principle supports any of these fonts, since its output must be translated to other formats with plot.
`--list-fonts'
Like `--help-fonts', but lists the fonts in a single column to facilitate piping to other programs. If no display type or output format is specified with the `-T' option, the full set of supported fonts is listed.
`--version'
Print the version number of plotfont and the plotting utilities package, and exit.

Environment variables

The behavior of plotfont is affected by several environment variables, which are the same as those that affect graph, plot, and tek2plot. For convenience, we list them here.

We have already mentioned the environment variables BITMAPSIZE, PAGESIZE, and BG_COLOR. They serve as backups for the options `--bitmap-size', `--page-size', and `--bg-color'. The remaining environment variables are specific to individual output formats.

plotfont -T X, which pops up a window on an X Window System display and draws a character map in it, checks the DISPLAY environment variable. The value of this variable determines the display on which the window will be popped up.

plotfont -T pnm, which produces output in Portable Anymap (PBM/PGM/PPM) format, is affected by the PNM_PORTABLE environment variable. If its value is "yes", the output file will be in the portable (human readable) version of PBM, PGM, or PPM format, rather than the default (binary) version.

plotfont -T gif, which produces output in pseudo-GIF format, is affected by two environment variables. If the value of the INTERLACE variable is "yes", the pseudo-GIF output file will be in interlaced format. Also, if the value of the TRANSPARENT_COLOR environment variable is the name of a color that appears in the output file, that color will be treated as transparent by most applications that read GIF files. For information on what color names are recognized, see section Specifying Colors by Name.

plotfont -T pcl, which produces PCL 5 output for Hewlett--Packard printers and plotters, is affected by several environment variables. The position of the graphics display on the page can be adjusted by setting the PCL_XOFFSET and PCL_YOFFSET environment variables, which may be specified in centimeters, millimeters, or inches. For example, an offset could be specified as "2cm" or "1.2in". Also, the display can be rotated 90 degrees counterclockwise on the page by setting the PCL_ROTATE environment variable to "yes". This is not the same as the rotation obtained with the --rotation option, which sets the rotation angle of the character map within the display. Besides "no" and "yes", recognized values for the PCL_ROTATE variable are "0", "90", "180", and "270". "no" and "yes" are equivalent to "0" and "90", respectively.

The variable PCL_ASSIGN_COLORS is also recognized. It should be set to "yes" when producing PCL 5 output for a color printer or other color device. This will ensure accurate color reproduction by giving the output device complete freedom in assigning colors, internally, to its "logical pens". If it is "no" then the device will use a fixed set of colored pens, and will emulate other colors by shading. The default is "no" because monochrome PCL 5 devices, which are much more common than colored ones, must use shading to emulate color.

plotfont -T hpgl, which produces Hewlett--Packard Graphics Language output, is also affected by several environment variables. The most important is HPGL_VERSION, which may be set to "1", "1.5", or "2" (the default). "1" means that the output should be generic HP-GL, "1.5" means that the output should be suitable for the HP7550A graphics plotter and the HP758x, HP7595A and HP7596A drafting plotters (HP-GL with some HP-GL/2 extensions), and "2" means that the output should be modern HP-GL/2. If the version is "1" or "1.5" then the only available fonts will be vector fonts.

The position of the plotfont -T hpgl graphics display on the page can be adjusted by setting the HPGL_XOFFSET and HPGL_YOFFSET environment variables, which may be specified in centimeters, millimeters, or inches. For example, an offset could be specified as "2cm" or "1.2in". Also, the display can be rotated 90 degrees counterclockwise on the page by setting the HPGL_ROTATE environment variable to "yes". This is not the same as the rotation obtained with the --rotation option, which sets the rotation angle of the character map within the display. Besides "no" and "yes", recognized values for the HPGL_ROTATE variable are "0", "90", "180", and "270". "no" and "yes" are equivalent to "0" and "90", respectively. "180" and "270" are supported only if HPGL_VERSION is "2" (the default).

By default, plotfont -T hpgl will draw with a fixed set of pens. Which pens are present may be specified by setting the HPGL_PENS environment variable. If HPGL_VERSION is "1", the default value of HPGL_PENS is "1=black"; if HPGL_VERSION is "1.5" or "2", the default value of HPGL_PENS is "1=black:2=red:3=green:4=yellow:5=blue:6=magenta:7=cyan". The format should be self-explanatory. By setting HPGL_PENS, you may specify a color for any pen in the range #1...#31. For information on what color names are recognized, see section Specifying Colors by Name. Pen #1 must always be present, though it need not be black. Any other pen in the range #1...#31 may be omitted.

If HPGL_VERSION is "2" then plotfont -T hpgl will also be affected by the environment variable HPGL_ASSIGN_COLORS. If the value of this variable is "yes", then plotfont -T hpgl will not be restricted to the palette specified in HPGL_PENS: it will assign colors to "logical pens" in the range #1...#31, as needed. The default value is "no" because other than color LaserJet printers and DesignJet plotters, not many HP-GL/2 devices allow the assignment of colors to logical pens.

plotfont -T tek, which produces output for a Tektronix terminal or emulator, checks the TERM environment variable. If the value of TERM is "xterm", "xterms", or "kterm", it is taken as a sign that the current application is running in an X Window System VT100 terminal emulator: an xterm. Before drawing graphics, plotfont -T tek will emit an escape sequence that causes the terminal emulator's auxiliary Tektronix window, which is normally hidden, to pop up. After the graphics are drawn, an escape sequence that returns control to the original VT100 window will be emitted. The Tektronix window will remain on the screen.

If the value of TERM is "kermit", "ansi.sys", "ansissys", "ansi.sysk", or "ansisysk", it is taken as a sign that the current application is running in the VT100 terminal emulator provided by the MS-DOS version of kermit. Before drawing graphics, plotfont -T tek will emit an escape sequence that switches the terminal emulator to Tektronix mode. Also, some of the Tektronix control codes emitted by plotfont -T tek will be kermit-specific. There will be a limited amount of color support, which is not normally the case (the 16 ansi.sys colors will be supported). After drawing graphics, plotfont -T tek will emit an escape sequence that returns the emulator to VT100 mode. The key sequence `ALT minus' can be employed manually within kermit to switch between the two modes.


Go to the first, previous, next, last section, table of contents.