This function is much like string_widths_dev()
but also returns the ascent
and descent of the string making it possible to construct a tight bounding
box around the string.
string_metrics_dev(
strings,
family = "",
face = 1,
size = 12,
cex = 1,
unit = "cm"
)
A character vector of strings to measure
The font families to use. Will get recycled
The font faces to use. Will get recycled
The font size to use. Will get recycled
The cex multiplier to use. Will get recycled
The unit to return the width in. Either "cm"
, "inches"
,
"device"
, or "relative"
A data.frame with width
, ascent
, and descent
columns giving the
metrics in the requested unit.
Other device metrics:
string_widths_dev()
# Get the metrics as measured in cm (default)
string_metrics_dev(c('some text', 'a string with descenders'))
#> # A tibble: 2 × 3
#> width ascent descent
#> <dbl> <dbl> <dbl>
#> 1 1.82 0.283 0.00635
#> 2 4.57 0.304 0.0931