Rev 29974 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{postscriptFonts}\alias{postscriptFont}\alias{postscriptFonts}\concept{fonts}\concept{encoding}\title{PostScript Fonts}\description{These functions handle the translation of a generic R graphicsfont family name to a PostScript font description.}\usage{postscriptFont(family, metrics, encoding = "default")postscriptFonts(...)}\arguments{\item{family}{a character string giving the name of an Adobe Type 1font family.}\item{metrics}{a vector of four or five strings giving pathsto the afm (font metric) files for the Type 1 font.}\item{encoding}{the name of an encoding file. Defaults to#ifdef unix"ISOLatin1.enc"#endif#ifdef windows"WinAnsi.enc"#endifin the \file{R\_HOME/afm} directory, which is usedif the path does not contain a path separator. An extension\code{".enc"} can be omitted.}\item{\dots}{either character strings naming mappings to display,or new (named) mappings to define.}}\details{A PostScript device is created with a default font (seethe documentation for \code{postscript}), but it is also possibleto specify a font family when drawing to the device(for example, see the documentation for \code{gpar} in thegrid package).The font family sent to the device is a simple string name, which must bemapped to something more specific to PostScript fonts. A list ofmappings is maintained and can be modified by the user.The \code{postscriptFonts} function can be used to list existingtranslations and to define new mappings. The \code{postscriptFont}function can be used to create a new mapping.}\section{Families}{The argument \code{family} specifies the font family to be used.Default mappings are provided for fourdevice-independent family names: \code{"sans"} for asans-serif font,\code{"serif"} for a serif font, \code{"mono"} for a monospaced font,and \code{"symbol"} for a symbol font.Mappings for a number of standard Adobe fonts(and URW equivalents) are also provided:\code{"AvantGarde"},\code{"Bookman"}, \code{"Courier"}, \code{"Helvetica"},\code{"Helvetica-Narrow"}, \code{"NewCenturySchoolbook"},\code{"Palatino"} and \code{"Times"};\code{"URWGothic"}, \code{"URWBookman"}, \code{"NimbusMon"},\code{"NimbusSan"}, \code{"NimbusSanCond"}, \code{"CenturySch"},\code{"URWPalladio"} and \code{"NimbusRom"}.It is also possible to specify \code{family="ComputerModern"}. Thisis intended to use with the Type 1 versions of the TeX CM fonts. Itwill normally be possible to include such output in TeX or LaTeXprovided it is processed with \code{dvips -Ppfb -j0} or the equivalenton your system. (\code{-j0} turns off font subsetting.)}\section{Metrics}{The \code{metrics} argument should be acharacter vector of four or five paths to Adobe Font Metric files forthe regular, bold, italic, bold italic and (optionally) symbol fonts tobe used. If these paths do not contain the file separator, they aretaken to refer to files in the \R directory \file{R\_HOME/afm}. Thus thedefault Helvetica family can be specified by \code{family =c("hv______.afm","hvb_____.afm", "hvo_____.afm", "hvbo____.afm", "sy______.afm")}.It is the user's responsibility to check that suitable fonts are madeavailable, and that they contain the needed characters whenre-encoded. The fontnames used are taken from the \code{FontName}fields of the afm files. The software including the PostScript plotfile should either embed the font outlines (usually from \file{.pfb}or \file{.pfa} files) or use DSC comments to instruct the printspooler to do so.The \code{.afm} files for the first four fonts do not need to be inthe correct encoding, but that for the symbol font must be.When \code{family="ComputerModern"} is used, the italic/bold-italicfonts used are slanted fonts (\code{cmsl10} and \code{cmbxsl10}). Touse text italic fonts instead, define a mapping with\code{metrics = c("CM_regular_10.afm", "CM_boldx_10.afm", "cmti10.afm","cmbxti10.afm", "CM_symbol_10.afm")}.}\section{Encodings}{Encodings describe which glyphs are used to display the character codes(in the range 0--255). By default, \R uses ISOLatin1 on unix andWinAnsi on Windows, andthe examples for \code{\link{text}} are in that encoding. However,the encoding used on machines running \R may well be different, and byusing the \code{encoding} argument the glyphs can be matched toencoding in use.None of this will matter if only ASCII characters (codes 32--126) areused as all the encodings agree over that range. Some encodings aresupersets of ISOLatin1, too. However, if accented and specialcharacters do not come out as you expect, you may need to change theencoding. Three other encodings are supplied with \R:\code{"WinAnsi.enc"} and \code{"MacRoman.enc"} correspond to theencodings normally used on Windows and MacOS (at least by Adobe), and\code{"PDFDoc.enc"} is the first 256 characters of the Unicodeencoding, the standard for PDF.If you change the encoding, it is your responsibility to ensure thatthe PostScript font contains the glyphs used. One issue here is the Eurosymbol which is in the WinAnsi and MacRoman encodings but may well notbe in the PostScript fonts. (It is in the URW variants; it is not inthe supplied Adobe Font Metric files.)There is one exception. Character 45 (\code{"-"}) is always setas minus (its value in Adobe ISOLatin1) even though it is hyphen inthe other encodings. Hyphen is available as character 173 (octal0255) in ISOLatin1.}\seealso{\code{\link{postscript}}}\author{Support for Computer Modern fonts is based on a contribution byBrian D'Urso \email{durso@hussle.harvard.edu}.}\examples{postscriptFonts()CMitalic <- postscriptFont("ComputerModern",c("CM_regular_10.afm", "CM_boldx_10.afm","cmti10.afm", "cmbxti10.afm","CM_symbol_10.afm"))postscriptFonts(CMitalic=CMitalic)}\keyword{device}