string_metrics_dev: Get string metrics as measured by the current device

Description Usage Arguments Value See Also Examples

View source: R/dev_strings.R

Description

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.

Usage

1
2
3
4
5
6
7
8
string_metrics_dev(
  strings,
  family = "",
  face = 1,
  size = 12,
  cex = 1,
  unit = "cm"
)

Arguments

strings

A character vector of strings to measure

family

The font families to use. Will get recycled

face

The font faces to use. Will get recycled

size

The font size to use. Will get recycled

cex

The cex multiplier to use. Will get recycled

unit

The unit to return the width in. Either "cm", "inches", "device", or "relative"

Value

A data.frame with width, ascent, and descent columns giving the metrics in the requested unit.

See Also

Other device metrics: string_widths_dev()

Examples

1
2
# Get the metrics as measured in cm (default)
string_metrics_dev(c('some text', 'a string with descenders'))

systemfonts documentation built on Oct. 23, 2020, 8 p.m.