The R Project SVN R

Rev

Rev 56186 | Rev 63675 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/grDevices/man/postscriptFonts.Rd
2
% Part of the R package, http://www.R-project.org
59039 ripley 3
% Copyright 1995-2007 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
 
36035 ripley 62
  There are also mappings for \code{"ComputerModern"} and
63
  \code{"ComputerModernItalic"}.
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
37893 ripley 74
  use DSC comments to instruct the print spooler or including
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
85
  already in the \R session.  (For these purposes \code{xfig} counts the
86
  same as \code{postscript} but only uses some of the predefined mappings.)
29974 murrell 87
}
37893 ripley 88
\section{East Asian fonts}{
89
  There are some default mappings for East Asian locales:\cr
90
  \code{"Japan1"}, \code{"Japan1HeiMin"}, \code{"Japan1GothicBBB"},
91
  and \code{"Japan1Ryumin"} for Japanese;
92
  \code{"Korea1"} and \code{"Korea1deb"} for Korean;
93
  \code{"GB1"} (Simplified Chinese) for mainland China and Singapore;
94
  \code{"CNS1"} (Traditional Chinese) for Hong Kong and Taiwan.
95
 
96
  These refer to the following fonts
97
  \tabular{ll}{
98
    Japan1 (PS) \tab \code{HeiseiKakuGo-W5}\cr \tab Linotype Japanese printer font\cr
99
    Japan1 (PDF) \tab \code{KozMinPro-Regular-Acro}\cr \tab from Adobe Reader 7.0 Japanese Font Pack\cr
100
    Japan1HeiMin (PS) \tab \code{HeiseiMin-W3}\cr \tab Linotype Japanese printer font\cr
101
    Japan1HeiMin (PDF) \tab \code{HeiseiMin-W3-Acro}\cr \tab from Adobe Reader 7.0 Japanese Font Pack\cr
102
    Japan1GothicBBB \tab \code{GothicBBB-Medium}\cr \tab Japanese-market PostScript printer font\cr
103
    Japan1Ryumin \tab \code{Ryumin-Light}\cr \tab Japanese-market PostScript printer font\cr
104
    Korea1 (PS) \tab \code{Baekmuk-Batang}\cr  \tab TrueType font found on some Linux systems\cr
105
    Korea1 (PDF) \tab \code{HYSMyeongJoStd-Medium-Acro}\cr  \tab from Adobe Reader 7.0 Korean Font Pack\cr
106
    Korea1deb (PS) \tab \code{Batang-Regular}\cr  \tab another name for Baekmuk-Batang\cr
107
    Korea1deb (PDF) \tab \code{HYGothic-Medium-Acro}\cr  \tab from Adobe Reader 4.0 Korean Font Pack\cr
108
    GB1 (PS) \tab \code{BousungEG-Light-GB}\cr  \tab TrueType font found on some Linux systems\cr
109
    GB1 (PDF) \tab \code{STSong-Light-Acro}\cr  \tab from Adobe Reader 7.0 Simplified Chinese Font Pack\cr
110
    CNS1 (PS) \tab \code{MOESung-Regular}\cr \tab Ken Lunde's CJKV resources\cr
111
    CNS1 (PDF) \tab \code{MSungStd-Light-Acro}\cr  \tab from Adobe Reader 7.0 Traditional Chinese Font Pack\cr
112
  }
113
  \code{Baekmuk-Batang} can be found at \url{ftp://ftp.mizi.com/pub/baekmuk/}.
114
  \code{BousungEG-Light-GB} can be found at
115
  \url{ftp://ftp.gnu.org/pub/non-gnu/chinese-fonts-truetype/}.
116
  Ken Lunde's CJKV resources are at
117
  \url{ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/samples/}.
118
  These will need to be installed or otherwise made available to the
119
  postscript/PDF interpreter such as ghostscript (and not all
120
  interpreters can handle TrueType fonts).
121
 
122
  You may well find that your postscript/PDF interpreters has been set
123
  up to provide aliases for many of these fonts.  For example,
124
  ghostscript on Windows can optionally be installed to map common CJK
125
  fonts names to Windows TrueType fonts.  (You may want to add the
126
  \code{-Acro} versions as well.)
127
 
128
  Adding a mapping for a CID-keyed font is for gurus only.
129
}
31039 murrell 130
\value{
36170 ripley 131
  A list of one or more font mappings.
29974 murrell 132
}
133
\seealso{
36128 murrell 134
  \code{\link{postscript}} and \code{\link{pdf}};  \code{\link{Type1Font}}
36141 ripley 135
  and \code{\link{CIDFont}} for specifying new font mappings.
29974 murrell 136
}
137
\author{
138
  Support for Computer Modern fonts is based on a contribution by
139
  Brian D'Urso \email{durso@hussle.harvard.edu}.
140
}
141
\examples{
142
postscriptFonts()
36035 ripley 143
## This duplicates "ComputerModernItalic".
36170 ripley 144
CMitalic <- Type1Font("ComputerModern2",
36141 ripley 145
                      c("CM_regular_10.afm", "CM_boldx_10.afm",
146
                        "cmti10.afm", "cmbxti10.afm",
147
                         "CM_symbol_10.afm"),
148
                      encoding = "TeXtext.enc")
36150 ripley 149
postscriptFonts(CMitalic = CMitalic)
150
 
36170 ripley 151
## A CID font for Japanese using a different CMap and
37893 ripley 152
## corresponding cmapEncoding.
36150 ripley 153
`Jp_UCS-2` <- CIDFont("TestUCS2",
154
                  c("Adobe-Japan1-UniJIS-UCS2-H.afm",
155
                    "Adobe-Japan1-UniJIS-UCS2-H.afm",
156
                    "Adobe-Japan1-UniJIS-UCS2-H.afm",
157
                    "Adobe-Japan1-UniJIS-UCS2-H.afm"),
158
                  "UniJIS-UCS2-H", "UCS-2")
159
pdfFonts(`Jp_UCS-2` = `Jp_UCS-2`)
160
names(pdfFonts())
29974 murrell 161
}
162
\keyword{device}