If these functions are called with no argument they list all the
existing mappings, whereas if they are called with named arguments
they add (or change) mappings. A PostScript or PDF device is created with a default font family (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 "family"
in par
and for
"fontfamily"
in gpar
in the grid package).
The font family sent to the device is a simple string name, which must be
mapped to a set of PostScript fonts. Separate lists of mappings for
postscript
and pdf
devices are maintained for the
current R session and can be added to by the user.
The postscriptFonts
and pdfFonts
functions can be used
to list existing mappings and to define new mappings. The
Type1Font
and CIDFont
functions can be
used to create new mappings, when the xxxFonts
function is used
to add them to the database. See the examples.
Default mappings are provided for three device-independent family
names: "sans"
for a sans-serif font (to "Helvetica"
),
"serif"
for a serif font (to "Times"
) and "mono"
for a monospaced font (to "Courier"
).
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 are also mappings for "ComputerModern"
,
"ComputerModernItalic"
and, as from R 3.1.0, "ArialMT"
(Monotype Arial).
Finally, there are some default mappings for East Asian locales
described in a separate section.
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 or PDF file, so
software including the PostScript or PDF plot file should either embed
the font outlines (usually from .pfb or .pfa files) or
use DSC comments to instruct the print spooler or including
application to do so (see also embedFonts
).
A font family has both an R-level name, the argument name used when
postscriptFonts
was called, and an internal name, the
family
component. These two names are the same for all the
pre-defined font families.
Once a font family is in use it cannot be changed. In use
means that it has been specified via a family
or
fonts
argument to an invocation of the same graphics device
already in the R session. (For these purposes xfig
counts the
same as postscript
but only uses some of the predefined mappings.)