Skip to contents
  • s3_export_fonts - uploads ttf files from a specified local directory to S3 folder with corresponding name in 'share-fonts' S3 bucket.

  • s3_import_fonts - downloads specified font family from S3 bucket. This function is meant to be used in EC2 RStudio instances, so it only knows where to put fonts on Linux systems, namely to '~/.local/share/fonts/truetype'. Function throws error if the system is not Linux. Typically you'd need to restart R session to make the fonts work (in RStudio: Session -> Restart R).

  • s3_list_fonts - list all fonts available in 'share-fonts' S3 bucket. Returns a data.frame with two columns: 1) font_family - this is in fact just a name of S3 folder with ttf files 2) font_name - ttf file names.

Usage

s3_export_fonts(font_dir)

s3_import_fonts(font_family, overwrite = FALSE)

s3_list_fonts()

Arguments

font_dir

local directory with ttf font files to export

font_family

font family (i.e. font folder) to export from S3 bucket 'share-fonts'. Use s3_list_fonts to see which fonts are available.

overwrite

overwrite font files if there already exists a local font directory with the same name? Default is FALSE.

Examples

if (FALSE) { # \dontrun{
# on local machine ---------------------------
# make sure to read .Renviron
# local folder containing fonts
s3_export_fonts("~/.local/share/fonts/truetype/VisueltPro/")

# check that fonts are now available on S3
s3_list_fonts()
#>    font_family                   font_name
#> 1   VisueltPro        VisueltPro-Black.ttf
#> 2   VisueltPro  VisueltPro-BlackItalic.ttf
#> 3   VisueltPro         VisueltPro-Bold.ttf
#> 4   VisueltPro   VisueltPro-BoldItalic.ttf
#> 5   VisueltPro       VisueltPro-Italic.ttf
#> 6   VisueltPro        VisueltPro-Light.ttf
#> 7   VisueltPro  VisueltPro-LightItalic.ttf
#> 8   VisueltPro       VisueltPro-Medium.ttf
#> 9   VisueltPro VisueltPro-MediumItalic.ttf
#> 10  VisueltPro      VisueltPro-Regular.ttf

# on EC2 RStudio -----------------------------
s3_import_fonts("VisueltPro")
} # }