download(1)


download -- download host-resident PostScript Type 1 fonts

Synopsis

download [options] [files]

Description

download prepends host resident Type 1 fonts to files and writes the results on the standard output. If no files are specified, or if - is one of the input files, the standard input is read. download assumes the input files make up a single PostScript job and that requested fonts can be included at the start of each input file. The following options are understood:

-f
Force a complete scan of each input file. In the absence of an explicit comment pointing download to the end of the file, the default scan stops immediately after the PostScript header comments.

-p printer
Before downloading, check the list of printer-resident Type 1 fonts in /etc/lp/printers/printer/residentfonts.
This file may have to be updated manually with the names of the ROM-resident Type 1 fonts when the PostScript printer named printer is installed. Otherwise, this option will point to an empty or non-existent file and ROM-resident fonts will be downloaded from the host when not needed. See the section ``Defining ROM-resident PostScript Fonts.''

-m name
Use name as the font map table. A name that begins with / is the full pathname of the map table and is used as is; otherwise name defaults to ``map'' and is appended to the pathname of the host font directory.

-H dir
Use dir as the host font directory. The default is the directory /usr/share/lib/hostfontdir.

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.

Retail type 1 fonts installed using the unixWare® desktop

The UnixWare desktop provides a capability for installing retail Type 1 fonts from diskette for use with the Desktop and lp. UnixWare includes Adobe Type Manager(TM) to render such fonts on the display. This capability installs the fonts in the directory /usr/X/lib/fonts/type1 and updates the map file in the directory /usr/share/lib/hostfontdir to make their location available to download. If Adobe Font Metric files with the file suffix .afm exist on the DOS diskette, these are copied as well, to the directory /usr/X/lib/fonts/type1/afm, for use by application developers.

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.

Defining ROM-resident postScript fonts

The -p option to download tells it to check a file named /etc/lp/printers/printer-name/residentfonts to see what Type 1 fonts are ROM-resident and disk-resident (some PostScript printers have directly attached fonts disks) in the printer so that it does not download such fonts. But this file is not automatically created when a PostScript printer is first set up on your system using lpadmin; you may need to create this file yourself.

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.

Obtaining the postScript font name for postScript application output

For an application to generate PostScript output that contains the required %%DocumentFonts: comment naming the Type 1 PostScript fonts needed by the PostScript job, the application must be able to obtain the PostScript font name. Since the PostScript Type 1 font name is named in the /FontName literal in a Type 1 program, but is not part of the XLFD font name, it is made available as the atom _ADOBE_POSTSCRIPT_FONTNAME in the X font structure for an outline font that is open as an X font. Application writers must use this mechanism to allow their PostScript fonts to be downloaded and used correctly.

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... */ } } }

Diagnostics

An exit status of 0 is returned if files were successfully processed.

References

dpost(1), lp(1), pfb2pfa(1), postdaisy(1), postdmd(1), postio(1), postmd(1), postprint(1), posttek(1)

Notices

The download program should be part of a more general program.

The download utility does not look for %%PageFonts: comments and there is no way to force multiple downloads of a particular font.

Examples

The following map table could be used to control the downloading of the Bookman font family:
     %
     % 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


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004