postscriptFonts package:grDevices R Documentation
_P_o_s_t_S_c_r_i_p_t _a_n_d _P_D_F _F_o_n_t _F_a_m_i_l_i_e_s
_D_e_s_c_r_i_p_t_i_o_n:
These functions handle the translation of a R graphics font family
name to a PostScript or PDF font description, used by the
'postscript' or 'pdf' graphics devices.
_U_s_a_g_e:
postscriptFonts(...)
pdfFonts(...)
_A_r_g_u_m_e_n_t_s:
...: either character strings naming mappings to display, or named
arguments specifying mappings to add or change.
_D_e_t_a_i_l_s:
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"').
Mappings for a number of standard Adobe fonts (and URW
equivalents) are also provided: '"AvantGarde"', '"Bookman"',
'"Courier"', '"Helvetica"', '"Helvetica-Narrow"',
'"NewCenturySchoolbook"', '"Palatino"' and '"Times"';
'"URWGothic"', '"URWBookman"', '"NimbusMon"', '"NimbusSan"'
(synonym '"URWHelvetica"'), '"NimbusSanCond"', '"CenturySch"',
'"URWPalladio"' and '"NimbusRom"' (synonym '"URWTimes"').
There are also mappings for '"ComputerModern"' and
'"ComputerModernItalic"'.
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.)
_V_a_l_u_e:
A list of one or more font mappings.
_E_a_s_t _A_s_i_a_n _f_o_n_t_s:
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.
These refer to the following fonts
Japan1 (PS) 'HeiseiKakuGo-W5'
Linotype Japanese printer font
Japan1 (PDF) 'KozMinPro-Regular-Acro'
from Adobe Reader 7.0 Japanese Font Pack
Japan1HeiMin (PS) 'HeiseiMin-W3'
Linotype Japanese printer font
Japan1HeiMin (PDF) 'HeiseiMin-W3-Acro'
from Adobe Reader 7.0 Japanese Font Pack
Japan1GothicBBB 'GothicBBB-Medium'
Japanese-market PostScript printer font
Japan1Ryumin 'Ryumin-Light'
Japanese-market PostScript printer font
Korea1 (PS) 'Baekmuk-Batang'
TrueType font found on some Linux systems
Korea1 (PDF) 'HYSMyeongJoStd-Medium-Acro'
from Adobe Reader 7.0 Korean Font Pack
Korea1deb (PS) 'Batang-Regular'
another name for Baekmuk-Batang
Korea1deb (PDF) 'HYGothic-Medium-Acro'
from Adobe Reader 4.0 Korean Font Pack
GB1 (PS) 'BousungEG-Light-GB'
TrueType font found on some Linux systems
GB1 (PDF) 'STSong-Light-Acro'
from Adobe Reader 7.0 Simplified Chinese Font Pack
CNS1 (PS) 'MOESung-Regular'
Ken Lunde's CJKV resources
CNS1 (PDF) 'MSungStd-Light-Acro'
from Adobe Reader 7.0 Traditional Chinese Font Pack
'Baekmuk-Batang' can be found at . 'BousungEG-Light-GB' can be
found at . Ken
Lunde's CJKV resources are at .
These will need to be installed or otherwise made available to the
postscript/PDF interpreter such as ghostscript (and not all
interpreters can handle TrueType fonts).
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
CJK 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.
_A_u_t_h_o_r(_s):
Support for Computer Modern fonts is based on a contribution by
Brian D'Urso durso@hussle.harvard.edu.
_S_e_e _A_l_s_o:
'postscript' and 'pdf'; 'Type1Font' and 'CIDFont' for specifying
new font mappings.
_E_x_a_m_p_l_e_s:
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())