quartzFonts {grDevices} | R Documentation |
Quartz Fonts Setup
Description
These functions handle the translation of a device-independent R graphics
font family name to a quartz
font description.
They are only available on Unix-alikes, i.e, not on Windows, and typically used on the Mac.
Usage
quartzFont(family)
quartzFonts(...)
Arguments
family |
a character vector containing the four PostScript font names for plain, bold, italic, and bold italic versions of a font family. |
... |
either character strings naming mappings to display, or new (named) mappings to define. |
Details
A quartz device is created with a default font (see
the documentation for quartz
), but it is also possible
to specify a font family when drawing to the device
(for example, see the documentation for gpar
in the
grid package).
The font family sent to the device is a simple string name, which must be mapped to something more specific to quartz fonts. A list of mappings is maintained and can be modified by the user.
The quartzFonts
function can be used to list existing
mappings and to define new mappings. The quartzFont
function can be used to create a new mapping.
Default mappings are provided for three device-independent font family
names: "sans"
for a sans-serif font, "serif"
for a serif
font and "mono"
for a monospaced font.
See Also
quartz
for the default Mac graphics device.
Examples
if(.Platform$OS.type == "unix") { # includes macOS
utils::str( quartzFonts() ) # a list(serif = .., sans = .., mono = ..)
quartzFonts("mono") # the list(mono = ..) sublist of quartzFonts()
## Not run:
## for East Asian locales you can use something like
quartzFonts(sans = quartzFont(rep("AppleGothic", 4)),
serif = quartzFont(rep("AppleMyungjp", 4)))
## since the default fonts may well not have the glyphs needed
## End(Not run)
}