getTextSize: Calculate the Height and Width of a Text String

View source: R/draw.R

getTextSizeR Documentation

Calculate the Height and Width of a Text String

Description

getTextSize calculates the size of a box that contains the specified text string, the tight box surrounding it, and the baseline.

Usage

getTextSize(
  text,
  font_face = "simplex",
  font_scale = 1,
  italic = FALSE,
  thickness = 1
)

Arguments

text

A character string representing the text to be drawn.

font_face

A character string representing the font type of the text (default: "simplex"). See notes for a list of available font types.

font_scale

A numeric value representing the scale factor by which the font-specific base size is multiplied (default: 1).

italic

A logical specifying whether the text should italicized (default: FALSE).

thickness

A numeric value representing the thickness in pixels of the line (default: 1).

Value

A two-element vector corresponding to the height and width of the text string.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

Image, drawText

Examples

getTextSize("I'm a balloon")


swarm-lab/Rvision documentation built on Feb. 7, 2024, 4:59 a.m.