Fonts are specified using the family
, font
, cex
,
and useFreeType
arguments. Defaults for the currently active
device may be set using par3d
, or for future devices
using r3dDefaults
.The family
specification is the same as for standard graphics, i.e.
families c("serif", "sans", "mono", "symbol")
are normally
available, but users may add additional families. font
numbers
are restricted to the range 1 to 4 for standard, bold, italic and bold italic
respectively; with font 5 recoded as family "symbol"
font 1.
Using an unrecognized value for "family"
will result in
the system standard font as used in rgl up to version 0.76. That font
is not resizable and font
values are ignored.
If useFreeType
is TRUE
, then rgl will use the FreeType
anti-aliased fonts for drawing. This is generally desirable, and it is the
default if rgl was built to support FreeType.
FreeType fonts are specified using the rglFonts
function. This function
takes a vector of four filenames of TrueType font files which
will be used for the four styles regular, bold, italic and bold italic. The
vector is passed with a name to be used as the family name, e.g.
rglFonts(sans = c("/path/to/FreeSans.ttf", ...
. In order to
limit the file size, rgl
ships with just 3 font files, for
regular versions of the serif
, sans
and mono
families.
Additional free font files are available from the Amaya project at
http://dev.w3.org/cvsweb/Amaya/fonts/. See the example below for
how to specify a full set of fonts.
Full pathnames should normally be used to specify font files. If relative
paths are used, they are interpreted differently by platform. Currently
Windows fonts are looked for in the Windows fonts folder, while other
platforms use the current working directory.
If FreeType fonts are not used, then bitmapped fonts will be used instead.
On Windows these will be based on the fonts specified using the
#ifdef windows
windowsFonts
#endif
#ifndef windows
windowsFonts
#endif
function, and are resizable.
Other platforms will use the default bitmapped font which is not
resizable. Currently MacOSX does not support bitmapped fonts in
the Cocoa display used by R.app.
Bitmapped fonts have a limited number of characters supported; if any
unsupported characters are used, an error will be thrown.