nchar_ttype | R Documentation |
This function returns the width of each element x
as a multiple of the width of the space character
for in declared font, rounded up to the nearest
integer. This is used extensively in the text rendering
(toString()
) and pagination machinery for
calculating word wrapping, default column widths,
lines per page, etc.
nchar_ttype(
x,
fontspec = font_spec(),
tol = sqrt(.Machine$double.eps),
raw = FALSE
)
x |
( |
fontspec |
( |
tol |
( |
raw |
( |
String width is defined in terms of spaces within
the specified font. For monospace fonts, this definition
collapses to the number of characters in the string
(nchar()
), but for truetype fonts it does not.
For raw = FALSE
, non-integer values (the norm in a truetype
setting) for the number of spaces a string takes up is rounded
up, unless the multiple is less than tol
above the last integer
before it. E.g., if k - num_spaces < tol
for an integer
k
, k
is returned instead of k+1
.
font_spec()
nchar_ttype("hi there!")
nchar_ttype("hi there!", font_spec("Times"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.