Usage

Arguments

either character strings naming mappings to display,
or named arguments specifying mappings to add or change.

Details

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").

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.)

Value

A list of one or more font mappings.

East Asian fonts

There are some default mappings for East Asian locales:"Japan1", "Japan1HeiMin", "Japan1GothicBBB",
and "Japan1Ryumin" for Japanese;
"Korea1" and "Korea1deb" for Korean;
"GB1" (Simplified Chinese) for mainland China and Singapore;
"CNS1" (Traditional Chinese) for Hong Kong and Taiwan.

You may well find that your postscript/PDF interpreters has been set
up to provide aliases for many of these fonts. For example,
ghostscript on Windows can optionally be installed to map common East
Asian fonts names to Windows TrueType fonts. (You may want to add the
-Acro versions as well.)

Adding a mapping for a CID-keyed font is for gurus only.

Author(s)

Support for Computer Modern fonts is based on a contribution by
Brian D'Urso.

See Also

postscript and pdf; Type1Font
and CIDFont for specifying new font mappings.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

postscriptFonts()## This duplicates "ComputerModernItalic".
CMitalic <-Type1Font("ComputerModern2",c("CM_regular_10.afm","CM_boldx_10.afm","cmti10.afm","cmbxti10.afm","CM_symbol_10.afm"),
encoding ="TeXtext.enc")postscriptFonts(CMitalic = CMitalic)## A CID font for Japanese using a different CMap and## corresponding cmapEncoding.`Jp_UCS-2`<-CIDFont("TestUCS2",c("Adobe-Japan1-UniJIS-UCS2-H.afm","Adobe-Japan1-UniJIS-UCS2-H.afm","Adobe-Japan1-UniJIS-UCS2-H.afm","Adobe-Japan1-UniJIS-UCS2-H.afm"),"UniJIS-UCS2-H","UCS-2")pdfFonts(`Jp_UCS-2`=`Jp_UCS-2`)names(pdfFonts())