Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

font_info

Query font-specific information


Description

Get general information about a font, relative to a given size. Size specific measures will be returned in pixel units. The function is vectorised to the length of the longest argument.

Usage

font_info(
  family = "",
  italic = FALSE,
  bold = FALSE,
  size = 12,
  res = 72,
  path = NULL,
  index = 0
)

Arguments

family

The name of the font family

italic

logicals indicating the font style

bold

logicals indicating the font style

size

The pointsize of the font to use for size related measures

res

The ppi of the size related mesures

path, index

path an index of a font file to circumvent lookup based on family and style

Value

A data.frame giving info on the requested font + size combinations. The data.frame will contain the following columns:

path

The path to the font file

index

The 0-based index of the font in the fontfile

family

The family name of the font

style

The style name of the font

italic

A logical giving if the font is italic

bold

A logical giving if the font is bold

monospace

A logical giving if the font is monospace

weight

A factor giving the weight of the font

width

A factor giving the width of the font

kerning

A logical giving if the font supports kerning

color

A logical giving if the font has color glyphs

scalable

A logical giving if the font is scalable

vertical

A logical giving if the font is vertical

n_glyphs

The number of glyphs in the font

n_sizes

The number of predefined sizes in the font

n_charmaps

The number of character mappings in the font file

bbox

A bounding box large enough to contain any of the glyphs in the font

max_ascend

The maximum ascend of the tallest glyph in the font

max_descent

The maximum descend of the most descending glyph in the font

max_advance_width

The maximum horizontal advance a glyph can make

max_advance_height

The maximum vertical advance a glyph can make

lineheight

The height of a single line of text in the font

underline_pos

The position of a potential underlining segment

underline_size

The width the the underline

Examples

font_info('serif')

# Avoid lookup if font file is already known
sans <- match_font('sans')
font_info(path = sans$path, index = sans$index)

systemfonts

System Native Font Finding

v1.0.2
MIT + file LICENSE
Authors
Thomas Lin Pedersen [aut, cre] (<https://orcid.org/0000-0002-5147-4711>), Jeroen Ooms [aut] (<https://orcid.org/0000-0002-4035-0289>), Devon Govett [aut] (Author of font-manager), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.