Skip to contents

Convert a text element into an R object

Usage

letterObject(
  ch,
  fontfamily = "Helvetica",
  fontsize = 576,
  fontface = "plain",
  dim = c(480, 480)
)

Arguments

ch

text to be converted, usually just a single letter

fontfamily

R has a few default fonts that are always available, such as e.g. Helvetica, Arial, Courier New, and Garamond. Other fonts might be available depending on the platform used.

fontsize

by default 576. If the resulting string exceeds the boundary of the matrix returned, reduced font size

fontface

character value. Defaults to 'plain'. Other standard options are 'bold', 'italic', 'bold italic'. Some font families supports additional font faces.

dim

vector of length two specifying width and height (in pixels) of the temporary jpg file created for the letter. Defaults to 480 x 480 pixels.

Value

three dimensional matrix of dimension 480 x 480 x 3 of the pixel values, black background and white letter

Examples

# \donttest{
plot(letterObject("g", fontfamily="Times New Roman", fontsize=400))

plot(letterObject("q", fontsize=400))

plot(letterObject("B"))

# }