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.
font_info(
family = "",
italic = FALSE,
bold = FALSE,
size = 12,
res = 72,
path = NULL,
index = 0
)
A data.frame giving info on the requested font + size combinations. The data.frame will contain the following columns:
The path to the font file
The 0-based index of the font in the fontfile
The family name of the font
The style name of the font
A logical giving if the font is italic
A logical giving if the font is bold
A logical giving if the font is monospace
A factor giving the weight of the font
A factor giving the width of the font
A logical giving if the font supports kerning
A logical giving if the font has color glyphs
A logical giving if the font is scalable
A logical giving if the font is vertical
The number of glyphs in the font
The number of predefined sizes in the font
The number of character mappings in the font file
A bounding box large enough to contain any of the glyphs in the font
The maximum ascend of the tallest glyph in the font
The maximum descend of the most descending glyph in the font
The maximum horizontal advance a glyph can make
The maximum vertical advance a glyph can make
The height of a single line of text in the font
The position of a potential underlining segment
The width the the underline
The name of the font families to match
logical indicating the font slant
logical indicating whether the font weight
The pointsize of the font to use for size related measures
The ppi of the size related mesures
path an index of a font file to circumvent lookup based on family and style
font_info('serif')
# Avoid lookup if font file is already known
sans <- match_fonts('sans')
font_info(path = sans$path, index = sans$index)
Run the code above in your browser using DataLab