postscriptFonts {grDevices} | R Documentation

## PostScript Fonts

### Description

These functions handle the translation of a device-independent R graphics font family name to a PostScript font description, used by both the `postscript` and `pdf` graphics devices.

### Usage

    postscriptFont(family, metrics, encoding = "default")

    postscriptFonts(...)

### Arguments

`family` | a character string giving the name of an Adobe Type 1 font family.
`metrics` | a vector of four or five strings giving paths to the afm (font metric) files for the Type 1 font.
`encoding` | the name of an encoding file. Defaults to `"default"`, which maps to "ISOLatin1.enc" Otherwise, a file name in the ‘`afm`’ directory of the grDevices package, which is used if the path does not contain a path separator. An extension `".enc"` can be omitted.
`...` | either character strings naming mappings to display, or new (named) mappings to define.

### Details

A PostScript device is created with a default font (see the documentation for `postscript`), but it is also possible to specify a font family when drawing to the device (for example, see the documentation for `gpar` in the grid package). The font mechanism is shared with the `pdf` device.

The font family sent to the device is a simple string name, which must be mapped to something more specific to PostScript fonts. A list of mappings is maintained and can be modified by the user.

The `postscriptFonts` function can be used to list existing translations and to define new mappings. The `postscriptFont` function can be used to create a new mapping.

The argument `family` specifies the font family to be used. Default mappings are provided for four device-independent family names: `"sans"` for a sans-serif font, `"serif"` for a serif font, `"mono"` for a monospaced font, and `"symbol"` for a symbol font.

Mappings for a number of standard Adobe fonts (and URW equivalents) are also provided: `"AvantGarde"`, `"Bookman"`, `"Courier"`, `"Helvetica"`, `"Helvetica-Narrow"`, `"NewCenturySchoolbook"`, `"Palatino"` and `"Times"`; `"URWGothic"`, `"URWBookman"`, `"NimbusMon"`, `"NimbusSan"` (synonym `"URWHelvetica"`), `"NimbusSanCond"`, `"CenturySch"`, `"URWPalladio"` and `"NimbusRom"` (synonym `"URWTimes"`).

There is also a mapping for `"ComputerModern"`.

The specification of font metrics and encodings is described in the help for the `postscript` function.

The fonts are not embedded in the resulting PostScript file, so software including the PostScript plot file should either embed the font outlines (usually from ‘`.pfb`’ or ‘`.pfa`’ files) or use DSC comments to instruct the print spooler to do so.

### Value

`postscriptFont` returns a PostScript font description.
`postscriptFonts` returns one or more font mappings.

### Author(s)

Support for Computer Modern fonts is based on a contribution by Brian D'Urso durso@hussle.harvard.edu.

### See Also

`postscript`

### Examples

    postscriptFonts()
    CMitalic <- postscriptFont("ComputerModern",
                               c("CM_regular_10.afm", "CM_boldx_10.afm",
                                 "cmti10.afm", "cmbxti10.afm",
                                 "CM_symbol_10.afm"))
    postscriptFonts(CMitalic=CMitalic)

[Package grDevices version 2.2.1 Index]