Requested fonts are named in a comment (marked with %%DocumentFonts:) in the input files. Available Type 1 fonts are the ones listed in the map table selected using the -m option.
The map table consists of font name-filename pairs. The font name is the name of the PostScript Type 1 font, exactly as it would appear in a %%DocumentFonts: comment and exactly as it appears in the literal /FontName in the Type 1 font program itself. The filename is the pathname of the host resident Type 1 font. A filename that begins with a ``/'' is used as is; otherwise the pathname is relative to the host font directory. Comments in the map table are introduced by ``%'' (as in PostScript) and extend to the end of the line.
The only candidates for downloading are fonts listed in the map table that point download to readable files. A Type 1 font is downloaded once, at most, for a single document, even if it occurs multiple times in the %%DocumentFonts: comment or PostScript file. The downloading of fonts occurs only for the duration of the PostScript job; however, permanent downloading of fonts to the printer's RAM can be done with special PostScript programming techniques using the exitserver operator.
Requests for unlisted fonts or inaccessible files are ignored; all requests are ignored if the map table can't be read.
Type 1 fonts may be in either compressed (binary) format (files with a suffix of .pfb) or the uncompressed (ASCII) format (files with a suffix of .pfa). Both formats contain most of their data in an encrypted form.
download converts Type 1 font files in binary format to ASCII during printing of output files.
A list of the Type 1 fonts in ROM or on disk of an attached PostScript printer can be obtained from the printer manufacturer's documentation and entered into the file /etc/lp/printers/printer-name/residentfonts. For PostScript printers attached via a serial line, a list of these fonts can also be generated using the postio command and a PostScript program available beginning with SVR4.2 (this does not work for PostScript printers attached on a parallel port).
To obtain the list of ROM fonts in a PostScript printer attached on a
serial line, first, obtain the device that the PostScript printer is
connected on:
lpstat -s
Given a system on which the PostScript printer prlocal is attached
on a serial line, this would return output like:
scheduler is running
no system default destination
device for prlocal: /dev/tty01
character set ^D
This shows that the printer is attached on device /dev/tty01.
Then, as root, run the commands
cd /usr/lib/lp/postscript
postio -L /tmp/postio.o -l /dev/tty01 -t romfonts.ps
The romfonts.ps program is a PostScript program that queries the PostScript printer for a list of resident fonts. For our sample prlocal printer, this will produce output in the file /tmp/postio.o that looks like:
printer startup %%[ status: waiting; source: serial 25 ]%% %%[ status: endofjob ]%% %%[ status: idle ]%% sending file romfonts.ps waiting for end of job %%[ status: busy; source: serial 25 ]%% /AGaramond-Bold /AGaramond-BoldItalic /AGaramond-Italic /AGaramond-Regular /AvantGarde-Book /AvantGarde-BookOblique /AvantGarde-Demi /AvantGarde-DemiOblique . . . more PostScript font names . . . /ZapfChancery-MediumItalic /ZapfDingbats %%[ status: endofjob ]%% job complete
This file can be edited to contain only the font names in the printers memory (from Garamond-Bold through ZapfDingbats in the output shown above for the printer prlocal) and placed into the file /etc/lp/printers/prlocal/residentfonts to prevent downloading of these fonts from the host computer.
This name can be obtained by an application from the X font structure; this code sample shows the mechanism:
#include <stdio.h> #include <Xlib.h>#define false 0
main(int argc, char *argv[]) { Display *display; Atom adobePostScriptFontNameAtom, psfontNameAtom; char *XLFDString; XFontStruct *newFont; char *psfontName;
if (argc > 1) XLFDString = argv[1]; else { fprintf(stderr, "usage: %s XLFDname\n", argv[0]); exit(1); }
display = XOpenDisplay(NULL);
adobePostScriptFontNameAtom = XInternAtom(display, "_ADOBE_POSTSCRIPT_FONTNAME", false);
/* Do some gratuitous error checking... */ if (adobePostScriptFontNameAtom == None) { adobePostScriptFontNameAtom = 0L; /* Some sort of error report - if ATM is in the server, this atom should have been registered at X startup time - unless, of course, ATM is done as a dynamic extension. But then, an atom should have been created anyway. */ }
/* This is the part that actually gets the font name from out of the font. newFont is an (XFontStruct *) as returned by XLoadQueryFont. */ if ((newFont = XLoadQueryFont(display, XLFDString)) == NULL) { fprintf(stderr, "Can't load font %s\n", XLFDString); exit(1); } if (adobePostScriptFontNameAtom) { /* psfontNameAtom is an unsigned long (Atom). */ if (XGetFontProperty(newFont, adobePostScriptFontNameAtom, &psfontNameAtom)) {
/* psfontName is a (char *). According to the X documentation, XGetAtomName is doing the allocating here, and the application is expected to XFree the psfontName when it is done. */
psfontName = XGetAtomName(display, psfontNameAtom); if (psfontName) printf("psfontName=%s\n", psfontName); else { /* ...Error, do something... */ }
/* Do whatever is wanted with the psfontName - store it away, use it in outputting to a file, etc. */ if (psfontName) (void)XFree(psfontName); } else /* XGetFontProperty */ { /* This font didn't come through a path which put the PostScript Type 1 font name into the properties list. Do some sort of backup thing, or error handling... */ } } }
The download utility does not look for %%PageFonts: comments and there is no way to force multiple downloads of a particular font.
% % The first string is the full PostScript font name. % The second string is the file name - relative to the % host font directory unless it begins with a /. % Bookman-Light bookman/light Bookman-LightItalic bookman/lightitalic Bookman-Demi bookman/demi Bookman-DemiItalic bookman/demiitalic
The following entry would be created in the map file if the Copperplate Gothic font from the Adobe TypeSet 2 retail fonts package were installed using the UnixWare Desktop:
Copperplate-ThirtyOneAB /usr/X/lib/fonts/type1/CP31A___.pfa
Using the file myprinter/map
(in the default host font directory)
as the map table,
you could download fonts
by issuing the following command:
download -m myprinter/map file