| 42333 |
ripley |
1 |
% File src/library/grDevices/man/postscriptFonts.Rd
|
| 68948 |
ripley |
2 |
% Part of the R package, https://www.R-project.org
|
| 80192 |
ripley |
3 |
% Copyright 1995-2021 R Core Team
|
| 42333 |
ripley |
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
| 29974 |
murrell |
6 |
\name{postscriptFonts}
|
| 56186 |
murdoch |
7 |
\alias{postscriptFonts}
|
| 36128 |
murrell |
8 |
\alias{pdfFonts}
|
| 29974 |
murrell |
9 |
\concept{fonts}
|
|
|
10 |
\concept{encoding}
|
| 36150 |
ripley |
11 |
\title{PostScript and PDF Font Families}
|
| 29974 |
murrell |
12 |
\description{
|
| 36150 |
ripley |
13 |
These functions handle the translation of a \R graphics
|
| 36128 |
murrell |
14 |
font family name to a PostScript or PDF font description, used by the
|
|
|
15 |
\code{\link{postscript}} or \code{\link{pdf}} graphics devices.
|
| 29974 |
murrell |
16 |
}
|
|
|
17 |
\usage{
|
| 37893 |
ripley |
18 |
postscriptFonts(\dots)
|
|
|
19 |
pdfFonts(\dots)
|
| 29974 |
murrell |
20 |
}
|
|
|
21 |
\arguments{
|
|
|
22 |
\item{\dots}{either character strings naming mappings to display,
|
| 36170 |
ripley |
23 |
or named arguments specifying mappings to add or change.}
|
| 29974 |
murrell |
24 |
}
|
|
|
25 |
\details{
|
| 36170 |
ripley |
26 |
If these functions are called with no argument they list all the
|
|
|
27 |
existing mappings, whereas if they are called with named arguments
|
|
|
28 |
they add (or change) mappings.
|
| 37893 |
ripley |
29 |
|
| 36150 |
ripley |
30 |
A PostScript or PDF device is created with a default font family (see the
|
| 36036 |
ripley |
31 |
documentation for \code{\link{postscript}}), but it is also possible
|
|
|
32 |
to specify a font family when drawing to the device (for example, see
|
| 36150 |
ripley |
33 |
the documentation for \code{"family"} in \code{\link{par}} and for
|
| 43748 |
ripley |
34 |
\code{"fontfamily"} in \code{\link{gpar}} in the \pkg{grid} package).
|
| 29974 |
murrell |
35 |
|
|
|
36 |
The font family sent to the device is a simple string name, which must be
|
| 36150 |
ripley |
37 |
mapped to a set of PostScript fonts. Separate lists of mappings for
|
|
|
38 |
\code{postscript} and \code{pdf} devices are maintained for the
|
|
|
39 |
current \R session and can be added to by the user.
|
| 29974 |
murrell |
40 |
|
| 36150 |
ripley |
41 |
The \code{postscriptFonts} and \code{pdfFonts} functions can be used
|
|
|
42 |
to list existing mappings and to define new mappings. The
|
|
|
43 |
\code{\link{Type1Font}} and \code{\link{CIDFont}} functions can be
|
|
|
44 |
used to create new mappings, when the \code{xxxFonts} function is used
|
|
|
45 |
to add them to the database. See the examples.
|
| 31039 |
murrell |
46 |
|
| 44481 |
ripley |
47 |
Default mappings are provided for three device-independent family
|
|
|
48 |
names: \code{"sans"} for a sans-serif font (to \code{"Helvetica"}),
|
|
|
49 |
\code{"serif"} for a serif font (to \code{"Times"}) and \code{"mono"}
|
|
|
50 |
for a monospaced font (to \code{"Courier"}).
|
| 29974 |
murrell |
51 |
|
| 36036 |
ripley |
52 |
Mappings for a number of standard Adobe fonts (and URW equivalents)
|
|
|
53 |
are also provided: \code{"AvantGarde"},
|
| 29974 |
murrell |
54 |
\code{"Bookman"}, \code{"Courier"}, \code{"Helvetica"},
|
|
|
55 |
\code{"Helvetica-Narrow"}, \code{"NewCenturySchoolbook"},
|
| 36036 |
ripley |
56 |
\code{"Palatino"} and \code{"Times"};
|
| 29974 |
murrell |
57 |
\code{"URWGothic"}, \code{"URWBookman"}, \code{"NimbusMon"},
|
| 36036 |
ripley |
58 |
\code{"NimbusSan"} (synonym \code{"URWHelvetica"}),
|
|
|
59 |
\code{"NimbusSanCond"}, \code{"CenturySch"}, \code{"URWPalladio"} and
|
|
|
60 |
\code{"NimbusRom"} (synonym \code{"URWTimes"}).
|
| 37893 |
ripley |
61 |
|
| 63675 |
ripley |
62 |
There are also mappings for \code{"ComputerModern"},
|
| 85925 |
hornik |
63 |
\code{"ComputerModernItalic"} and \code{"ArialMT"} (\I{Monotype} Arial).
|
| 29974 |
murrell |
64 |
|
| 37893 |
ripley |
65 |
Finally, there are some default mappings for East Asian locales
|
|
|
66 |
described in a separate section.
|
|
|
67 |
|
| 31039 |
murrell |
68 |
The specification of font metrics and encodings is described in the help
|
| 36036 |
ripley |
69 |
for the \code{\link{postscript}} function.
|
| 35480 |
murrell |
70 |
|
| 36128 |
murrell |
71 |
The fonts are not embedded in the resulting PostScript or PDF file, so
|
| 36150 |
ripley |
72 |
software including the PostScript or PDF plot file should either embed
|
|
|
73 |
the font outlines (usually from \file{.pfb} or \file{.pfa} files) or
|
| 85908 |
hornik |
74 |
use \abbr{DSC} comments to instruct the print spooler or including
|
| 37893 |
ripley |
75 |
application to do so (see also \code{\link{embedFonts}}).
|
| 36170 |
ripley |
76 |
|
|
|
77 |
A font family has both an \R-level name, the argument name used when
|
|
|
78 |
\code{postscriptFonts} was called, and an internal name, the
|
|
|
79 |
\code{family} component. These two names are the same for all the
|
|
|
80 |
pre-defined font families.
|
|
|
81 |
|
|
|
82 |
Once a font family is in use it cannot be changed. \sQuote{In use}
|
|
|
83 |
means that it has been specified \emph{via} a \code{family} or
|
|
|
84 |
\code{fonts} argument to an invocation of the same graphics device
|
| 87993 |
smeyer |
85 |
already in the \R session.
|
| 29974 |
murrell |
86 |
}
|
| 37893 |
ripley |
87 |
\section{East Asian fonts}{
|
|
|
88 |
There are some default mappings for East Asian locales:\cr
|
|
|
89 |
\code{"Japan1"}, \code{"Japan1HeiMin"}, \code{"Japan1GothicBBB"},
|
|
|
90 |
and \code{"Japan1Ryumin"} for Japanese;
|
|
|
91 |
\code{"Korea1"} and \code{"Korea1deb"} for Korean;
|
|
|
92 |
\code{"GB1"} (Simplified Chinese) for mainland China and Singapore;
|
|
|
93 |
\code{"CNS1"} (Traditional Chinese) for Hong Kong and Taiwan.
|
|
|
94 |
|
|
|
95 |
These refer to the following fonts
|
|
|
96 |
\tabular{ll}{
|
|
|
97 |
Japan1 (PS) \tab \code{HeiseiKakuGo-W5}\cr \tab Linotype Japanese printer font\cr
|
|
|
98 |
Japan1 (PDF) \tab \code{KozMinPro-Regular-Acro}\cr \tab from Adobe Reader 7.0 Japanese Font Pack\cr
|
| 85927 |
hornik |
99 |
\I{Japan1HeiMin} (PS) \tab \code{HeiseiMin-W3}\cr \tab Linotype Japanese printer font\cr
|
|
|
100 |
\I{Japan1HeiMin} (PDF) \tab \code{HeiseiMin-W3-Acro}\cr \tab from Adobe Reader 7.0 Japanese Font Pack\cr
|
| 85925 |
hornik |
101 |
\I{Japan1GothicBBB} \tab \code{GothicBBB-Medium}\cr \tab Japanese-market PostScript printer font\cr
|
|
|
102 |
\I{Japan1Ryumin} \tab \code{Ryumin-Light}\cr \tab Japanese-market PostScript printer font\cr
|
|
|
103 |
Korea1 (PS) \tab \code{Baekmuk-Batang}\cr \tab \I{TrueType} font found on some Linux systems\cr
|
| 37893 |
ripley |
104 |
Korea1 (PDF) \tab \code{HYSMyeongJoStd-Medium-Acro}\cr \tab from Adobe Reader 7.0 Korean Font Pack\cr
|
| 85925 |
hornik |
105 |
Korea1deb (PS) \tab \code{Batang-Regular}\cr \tab another name for \I{Baekmuk-Batang}\cr
|
| 37893 |
ripley |
106 |
Korea1deb (PDF) \tab \code{HYGothic-Medium-Acro}\cr \tab from Adobe Reader 4.0 Korean Font Pack\cr
|
| 85925 |
hornik |
107 |
GB1 (PS) \tab \code{BousungEG-Light-GB}\cr \tab \I{TrueType} font found on some Linux systems\cr
|
| 37893 |
ripley |
108 |
GB1 (PDF) \tab \code{STSong-Light-Acro}\cr \tab from Adobe Reader 7.0 Simplified Chinese Font Pack\cr
|
| 85925 |
hornik |
109 |
CNS1 (PS) \tab \code{MOESung-Regular}\cr \tab \I{Ken Lunde}'s \abbr{CJKV} resources\cr
|
| 37893 |
ripley |
110 |
CNS1 (PDF) \tab \code{MSungStd-Light-Acro}\cr \tab from Adobe Reader 7.0 Traditional Chinese Font Pack\cr
|
|
|
111 |
}
|
| 80192 |
ripley |
112 |
% \code{Baekmuk-Batang} was found at \url{ftp://ftp.mizi.com/pub/baekmuk/}.
|
| 37893 |
ripley |
113 |
\code{BousungEG-Light-GB} can be found at
|
| 80192 |
ripley |
114 |
\url{https://ftp.gnu.org/pub/non-gnu/chinese-fonts-truetype/}.
|
|
|
115 |
%% Ken Lunde's CJKV resources are at
|
|
|
116 |
%% \url{ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/samples/}.
|
| 37893 |
ripley |
117 |
These will need to be installed or otherwise made available to the
|
| 85254 |
hornik |
118 |
PostScript/PDF interpreter such as Ghostscript (and not all
|
| 85925 |
hornik |
119 |
interpreters can handle \I{TrueType} fonts).
|
| 37893 |
ripley |
120 |
|
|
|
121 |
You may well find that your postscript/PDF interpreters has been set
|
|
|
122 |
up to provide aliases for many of these fonts. For example,
|
| 85254 |
hornik |
123 |
Ghostscript on Windows can optionally be installed to map common East
|
| 85925 |
hornik |
124 |
Asian fonts names to Windows \I{TrueType} fonts. (You may want to add the
|
| 37893 |
ripley |
125 |
\code{-Acro} versions as well.)
|
|
|
126 |
|
|
|
127 |
Adding a mapping for a CID-keyed font is for gurus only.
|
|
|
128 |
}
|
| 31039 |
murrell |
129 |
\value{
|
| 36170 |
ripley |
130 |
A list of one or more font mappings.
|
| 29974 |
murrell |
131 |
}
|
|
|
132 |
\seealso{
|
| 36128 |
murrell |
133 |
\code{\link{postscript}} and \code{\link{pdf}}; \code{\link{Type1Font}}
|
| 36141 |
ripley |
134 |
and \code{\link{CIDFont}} for specifying new font mappings.
|
| 29974 |
murrell |
135 |
}
|
|
|
136 |
\author{
|
|
|
137 |
Support for Computer Modern fonts is based on a contribution by
|
| 67395 |
ripley |
138 |
Brian D'Urso.% formerly \email{durso@hussle.harvard.edu}.
|
| 29974 |
murrell |
139 |
}
|
|
|
140 |
\examples{
|
|
|
141 |
postscriptFonts()
|
| 36035 |
ripley |
142 |
## This duplicates "ComputerModernItalic".
|
| 36170 |
ripley |
143 |
CMitalic <- Type1Font("ComputerModern2",
|
| 36141 |
ripley |
144 |
c("CM_regular_10.afm", "CM_boldx_10.afm",
|
|
|
145 |
"cmti10.afm", "cmbxti10.afm",
|
|
|
146 |
"CM_symbol_10.afm"),
|
|
|
147 |
encoding = "TeXtext.enc")
|
| 36150 |
ripley |
148 |
postscriptFonts(CMitalic = CMitalic)
|
|
|
149 |
|
| 36170 |
ripley |
150 |
## A CID font for Japanese using a different CMap and
|
| 37893 |
ripley |
151 |
## corresponding cmapEncoding.
|
| 36150 |
ripley |
152 |
`Jp_UCS-2` <- CIDFont("TestUCS2",
|
|
|
153 |
c("Adobe-Japan1-UniJIS-UCS2-H.afm",
|
|
|
154 |
"Adobe-Japan1-UniJIS-UCS2-H.afm",
|
|
|
155 |
"Adobe-Japan1-UniJIS-UCS2-H.afm",
|
|
|
156 |
"Adobe-Japan1-UniJIS-UCS2-H.afm"),
|
|
|
157 |
"UniJIS-UCS2-H", "UCS-2")
|
|
|
158 |
pdfFonts(`Jp_UCS-2` = `Jp_UCS-2`)
|
|
|
159 |
names(pdfFonts())
|
| 29974 |
murrell |
160 |
}
|
|
|
161 |
\keyword{device}
|