Font Lookup

systemfonts is primarily a package to facilitate the lookup of fonts based on typeface and style. These functions facilitate this

match_fonts() match_font()

Find a system font by name and style

font_fallback()

Get the fallback font for a given string

system_fonts()

List all fonts installed on your system

reset_font_cache()

Reset the system font cache

Shaping

While text shaping is better handed off to the textshaping package, systemfonts does provide basic shaping functionality

shape_string()

Calculate glyph positions for strings

string_width()

Calculate the width of a string, ignoring new-lines

string_metrics_dev()

Get string metrics as measured by the current device

string_widths_dev()

Get string widths as measured by the current device

str_split_emoji()

Split a string into emoji and non-emoji glyph runs

Font file information

The following functions allow you to extract various kind of information from font files

font_info()

Query font-specific information

glyph_info()

Query glyph-specific information from fonts

glyph_outline()

Get the outline of glyphs

glyph_raster()

Render glyphs to raster image

glyph_raster_grob()

Convert an extracted glyph raster to a grob

plot_glyph_stats()

Create a visual representation of what the various glyph stats mean

Local fonts

While systemfonts was mainly created to access fonts installed on the system it also has rich support for using non-installed (local) font files from R. Further, it provides facilities for accessing system fonts that are otherwise inaccessible from R

add_fonts() scan_local_fonts() clear_local_fonts()

Add local font files to the search path

register_variant()

Register a font as a variant as an existing one

register_font() registry_fonts() clear_registry()

Register font collections as families

font_feature()

Define OpenType font feature settings

font_variation()

Define axis coordinates for variable fonts

Web fonts

Many fonts are now available online through font repositories. systemfonts provide access to these, both for installing and using directly, but also for embedding inside SVGs

search_web_fonts()

Search font repositories for a font based on family name

require_font()

Ensure font availability in a script

get_from_google_fonts() get_from_font_squirrel()

Download and add web font

fonts_as_import()

Create import specifications for web content