font_info {systemfonts}R Documentation

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 families to match

italic

logical indicating the font slant

bold

logical indicating whether the font weight

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_fonts('sans')
font_info(path = sans$path, index = sans$index)


[Package systemfonts version 1.1.0 Index]