The R Project SVN R

Rev

Rev 30655 | Rev 35855 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30655 Rev 31039
Line 3... Line 3...
3
\alias{postscriptFonts}
3
\alias{postscriptFonts}
4
\concept{fonts}
4
\concept{fonts}
5
\concept{encoding}
5
\concept{encoding}
6
\title{PostScript Fonts}
6
\title{PostScript Fonts}
7
\description{
7
\description{
8
  These functions handle the translation of a generic R graphics
8
  These functions handle the translation of a device-independent R graphics
9
  font family name to a PostScript font description.
9
  font family name to a PostScript font description.
10
}
10
}
11
\usage{
11
\usage{
12
postscriptFont(family, metrics, encoding = "default")
12
postscriptFont(family, metrics, encoding = "default")
13
 
13
 
Line 43... Line 43...
43
  mappings is maintained and can be modified by the user.
43
  mappings is maintained and can be modified by the user.
44
 
44
 
45
  The \code{postscriptFonts} function can be used to list existing
45
  The \code{postscriptFonts} function can be used to list existing
46
  translations and to define new mappings.  The \code{postscriptFont}
46
  translations and to define new mappings.  The \code{postscriptFont}
47
  function can be used to create a new mapping.
47
  function can be used to create a new mapping.
48
}
48
 
49
\section{Families}{
-
 
50
  The argument \code{family} specifies the font family to be used.
49
  The argument \code{family} specifies the font family to be used.
51
  Default mappings are provided for four
50
  Default mappings are provided for four
52
  device-independent family names: \code{"sans"} for a
51
  device-independent family names: \code{"sans"} for a
53
  sans-serif font,
52
  sans-serif font,
54
  \code{"serif"} for a serif font, \code{"mono"} for a monospaced font,
53
  \code{"serif"} for a serif font, \code{"mono"} for a monospaced font,
Line 62... Line 61...
62
  \code{"Palatino"} and \code{"Times"}; 
61
  \code{"Palatino"} and \code{"Times"}; 
63
  \code{"URWGothic"}, \code{"URWBookman"}, \code{"NimbusMon"},
62
  \code{"URWGothic"}, \code{"URWBookman"}, \code{"NimbusMon"},
64
  \code{"NimbusSan"}, \code{"NimbusSanCond"}, \code{"CenturySch"},
63
  \code{"NimbusSan"}, \code{"NimbusSanCond"}, \code{"CenturySch"},
65
  \code{"URWPalladio"} and \code{"NimbusRom"}.  
64
  \code{"URWPalladio"} and \code{"NimbusRom"}.  
66
 
65
 
67
  It is also possible to specify \code{family="ComputerModern"}. This
66
  There is also a mapping for \code{"ComputerModern"}.
68
  is intended to use with the Type 1 versions of the TeX CM fonts.  It
-
 
69
  will normally be possible to include such output in TeX or LaTeX
-
 
70
  provided it is processed with \code{dvips -Ppfb -j0} or the equivalent
-
 
71
  on your system. (\code{-j0} turns off font subsetting.)
-
 
72
}
-
 
73
\section{Metrics}{
-
 
74
  The \code{metrics} argument should be a
-
 
75
  character vector of four or five paths to Adobe Font Metric files for
-
 
76
  the regular, bold, italic, bold italic and (optionally) symbol fonts to
-
 
77
  be used.  If these paths do not contain the file separator, they are
-
 
78
  taken to refer to files in the \R directory \file{R\_HOME/afm}.  Thus the
-
 
79
  default Helvetica family can be specified by \code{family =
-
 
80
    c("hv______.afm",
-
 
81
    "hvb_____.afm", "hvo_____.afm", "hvbo____.afm", "sy______.afm")}.
-
 
82
  It is the user's responsibility to check that suitable fonts are made
-
 
83
  available, and that they contain the needed characters when
-
 
84
  re-encoded.  The fontnames used are taken from the \code{FontName}
-
 
85
  fields of the afm files.  The software including the PostScript plot
-
 
86
  file should either embed the font outlines (usually from \file{.pfb}
-
 
87
  or \file{.pfa} files) or use DSC comments to instruct the print
-
 
88
  spooler to do so.
-
 
89
 
67
 
90
  The \code{.afm} files for the first four fonts do not need to be in
68
  The specification of font metrics and encodings is described in the help
91
  the correct encoding, but that for the symbol font must be.
-
 
92
 
-
 
93
  When \code{family="ComputerModern"} is used, the italic/bold-italic
-
 
94
  fonts used are slanted fonts (\code{cmsl10} and \code{cmbxsl10}).  To
-
 
95
  use text italic fonts instead, define a mapping with
69
  for the \code{postscript} function.
96
  \code{metrics = c("CM_regular_10.afm", "CM_boldx_10.afm", "cmti10.afm",
-
 
97
    "cmbxti10.afm", "CM_symbol_10.afm")}.
-
 
98
}
70
}
99
 
-
 
100
\section{Encodings}{
71
\value{
101
  Encodings describe which glyphs are used to display the character codes
-
 
102
  (in the range 0--255).  By default, \R uses ISOLatin1 on unix and
-
 
103
  WinAnsi on Windows, and
-
 
104
  the examples for \code{\link{text}} are in that encoding.  However,
-
 
105
  the encoding used on machines running \R may well be different, and by
-
 
106
  using the \code{encoding} argument the glyphs can be matched to
72
  \code{postscriptFont} returns a PostScript
107
  encoding in use.
73
  font description.
108
 
-
 
109
  None of this will matter if only ASCII characters (codes 32--126) are
-
 
110
  used as all the encodings agree over that range.  Some encodings are
-
 
111
  supersets of ISOLatin1, too.  However, if accented and special
-
 
112
  characters do not come out as you expect, you may need to change the
-
 
113
  encoding.  Three other encodings are supplied with \R:
-
 
114
  \code{"WinAnsi.enc"} and \code{"MacRoman.enc"} correspond to the
-
 
115
  encodings normally used on Windows and MacOS (at least by Adobe), and
-
 
116
  \code{"PDFDoc.enc"} is the first 256 characters of the Unicode
-
 
117
  encoding, the standard for PDF.
-
 
118
 
74
 
119
  If you change the encoding, it is your responsibility to ensure that
-
 
120
  the PostScript font contains the glyphs used.  One issue here is the Euro
-
 
121
  symbol which is in the WinAnsi and MacRoman encodings but may well not
-
 
122
  be in the PostScript fonts.  (It is in the URW variants; it is not in
75
  \code{postscriptFonts} returns one or more font mappings.
123
  the supplied Adobe Font Metric files.)
-
 
124
 
-
 
125
  There is one exception.  Character 45 (\code{"-"}) is always set
-
 
126
  as minus (its value in Adobe ISOLatin1) even though it is hyphen in
-
 
127
  the other encodings.  Hyphen is available as character 173 (octal
-
 
128
  0255) in ISOLatin1.
-
 
129
}
76
}
130
\seealso{
77
\seealso{
131
  \code{\link{postscript}}
78
  \code{\link{postscript}}
132
}
79
}
133
\author{
80
\author{