powered by
Compute the width, ascent and descent of a single string in points, from the metrics stored in the font file.
str_metrics( x, fontname = "sans", fontsize = 12, bold = FALSE, italic = FALSE, fontfile = "" )
A named numeric vector with elements width, ascent and descent (unit is points).
width
ascent
descent
Character vector of strings to measure (only the first element is used).
Font name.
Font size in points.
Is text bold/italic?
Path to a font file. If empty, the font is resolved by name via 'systemfonts'.
Other functions for font metrics: font_line_metrics(), m_str_extents(), strings_sizes()
font_line_metrics()
m_str_extents()
strings_sizes()
str_metrics("Hello World!")
Run the code above in your browser using DataLab