CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.



next up previous
Next: psbook---rearrange pages in Up: PostScript tools Previous: PostScript tools

PostScript fonts

PostScript is a page description language and it can be used to code in an efficient way complex graphics images (For a short introduction, see my article ``PostScript, a language to describe text and graphics'' in CNL 199, pages 15--20, 1990, while a more detailed treatment can be found in PostScript by Example, by Henry McGilton and Mary Campione, Addison-Wesley, 1992).

Similarly, each character in a PostScript font is described by a small PostScript program, containing character outlines, i.e., collections of lines, arcs, and curves. To visualize the characters on an output device the PostScript interpreter ``rasterizes'' these outlines dynamically and transforms them into a bitmap image taking into account the resolution of the output device.

There are various kinds of fonts in PostScript, but we shall only look at Type 1 and Type 3 fonts.

Type 1 fonts

The Type 1 font format is a compact way of describing a font outline using a well-defined language that can be quickly interpreted. When a character is described in outline format the outline has unlimited resolution. If you make it ten times as big, it is just as accurate as if it were ten times as small.

However, to print, you must transfer the character outline to a sheet of paper through a device called a raster image processor (RIP). The RIP builds the image of the character out of lots of little squares called picture elements (pixels).

The problem is that a pixel has physical size and can be printed only as either black or white. Look at a sheet of graph paper: rows and columns of little squares (think: pixels). Draw a large ``O'' in the middle of the graph paper. Darken in all the squares touched by the O. Do the darkened squares form a letter that looks like the O you drew? This is the problem with low resolution (300 dpi). Which pixels do you turn on and which do you leave off to most accurately reproduce the character?

The solve this problem ``hints'' are introduced. All methods of hinting strive to fit (map) the outline of a character onto the pixel grid and produce the most pleasing/recognizable character no matter how coarse the grid is.

Most of the time the PostScript code is rasterised in the printers, which have a read-only memory (ROM) containing the PostScript interpreter, as well as the most commonly used fonts (e.g., Apple LaserWriters, DEC LPS, QMS, Tektronix are a few examples of printers we have in the computing centre that work on that principle). The PostScript code can equally well be rasterized on a computer, and translated in commands for X-window (NewsPrint of Sun, ghostview of the GNU Consortium), or in the language that a given printer understands (e.g., for the XEROX printer and Versatec plotter in the computing centre a Sun or Compac is used).

It should be evident from the above that, since your file contains PostScript code, and, moreover you use fonts, the translator needs a certain minimum amount of memory (RAM) to be able to rasterize the image. On a 300 dots per inch (dpi) black and white (BW) printer, you need about 1.1 Mbytes, at 600 dpi, four times more. As you must also leave room for rasterizing fonts, for the dictionaries, for expanding bitmaps which might be present in the input stream, and, of course, for the PostScript code corresponding to one output page, you should at least have 4 Mbytes of RAM on a BW 300 dpi printer, while 8 Mbytes is a minimum for a BW 600 dpi printer.

As a comparison, the Versatec can plot A0 drawings in four colours, so that the RAM requirements in the Sun that translates the PostScript for that device must be about 70 Mbytes, only for rasterizing the image.

Type 3 fonts

There is another format for PostScript fonts, namely the type 3 format, for which it is basically easier to develop font code, since you can use all PostScript operators to make your character images. It is however impossible to use hints, and also the rendering of these characters is less efficient than for type 1 fonts. This technique is used by the TeX companion program , for generating its bitmapped fonts using the the source descriptions. These bitmaps are later extracted from the packed font images (pk files) for all TeX fonts used in a TeX job. As these fonts are generated at a given resolution and for a given printer, they do not look good on a different printer or at a higher resolution than for which they were originally intended. Therefore, if you want to use higher resolution printers, you have to regenerate all the pk files at that resolution---a huge job, taking up many Mbytes of disk space. Alternatively, you can use type 1 renderings of the TeX fonts. The same also applies if you want to reduce your pages to print two or more pages onto one physical page (see the tools described below), since you then have to scale the fonts.

For all there reasons, we had bought at CERN a commercial version of all TeX-related fonts, namely the Computer Modern, LaTeX, Euler, and series. We have been using these fonts for printing the manuals and documentation of the packages developed by CN/ADS Group or the preprints of TH division, which are both printed reduced as two A5 pages side-by-side on one A4 page. Since these fonts are commercial, we can not make them generally available. In the summer of this year a public domain version appeared thanks to work of people in the Institute of High Energy Physics in Protvino (Russia). Under the direction of Vassily Malyshev they developed the ``Paradissa Fonts Collection'', which offers a type 1 version of all fonts you normally need for your work with LaTeX.

Since all pk font bitmaps which are available on the different computer platforms at CERN were basically generated for the LaerWriter printer at 300 dpi, you are advised to use these fonts as a substitution for the pk files, whenever you want to reduce your output, or you want to print it on a high resolution or non-Apple laser printer. Be aware, though, that these fonts take up a lot more space, (about 30 to 50 kbytes per font), so you should only need them for your final copy.

You can use these fonts by specifying the option -PPSA on the Progdvips command, e.g., on UNIX:

dvips -PPSA -oout.ps dvifile

To show the difference between font images at various resolutions, the word ``PostScript'' was generated below using the Computer Modern font and rasterized at 100 dpi (figure gif) and 300 dpi (figure gif). The natual size (10pt) is shown at the left, while the right corresponds to the same image magnified about three times. In each case the top (bitmap) version shows clearly its granularity, while the type 1 version (bottom) is a smooth outline.

  

What are Adobe Type Manager and Truetype?

Both the type 1 and type 3 formats are scalable, and both can be run on any PostScript interpreter. However, because of the requirement that a type 3 font program have a full PostScript interpreter around, type 3 font programs cannot be understood by the Adobe Type Manager (ATM). ATM is a utility to render smooth characters on Macintosh, PC and UNIX screens from type 1 font outlines instead of using bitmap fonts. Type 3 fonts cannot be used by ATM.

Some time ago Microsoft and Apple started to offer support for a new format of outline font, named Truetype. It allows high-quality characters of any size to be displayed on the screen. TrueType stores font outlines as B-spline curves along with programmed resolution hints. B-spline curves are faster to compute and easier to manipulate than the Bezier curves used in PostScript. You can also print these Truetype fonts on a PostScript printer using a program on the PC or the Mac.



next up previous
Next: psbook---rearrange pages in Up: PostScript tools Previous: PostScript tools



Janne Saarela
Tue May 16 13:43:26 METDST 1995