Add Custom Fonts with extrafonts

Pick your font

Download fonts from Google

  1. Visit fonts.google.com
  2. Save to filepath below
  3. Go to filepath, open, and install

Get filepath from file explorer.

NOT regular fonts file

  • Fileexplorer header: View > Show> Hidden Items
  • This is my path: “C:/Users/schlo/AppData/Local/Microsoft/Windows/Fonts”

Install Rttf2pt1 version 1.3.8

  • Newer versions do not work
	install.packages(“remotes”)  *don’t forget the s!
	library(remotes)
	remotes::install_version("Rttf2pt1", version = "1.3.8")
	library(Rttf2pt1)

install extrafonts & extrafontsdb

This will also install extrafontsdb and the newest Rttf2pt1 if you skipped step 3. In which case, you must uninstall Rttf2pt1 and install it correctly as above. This may require exiting R completely and restarting.

library(extrafonts)
library(extrafontsdb)

Use Them in R

font_import(path)

`font_import(“C:/Users/schlo/AppData/Local/Microsoft/Windows/Fonts”)`

Check font names with fonts() or header(fonts()) for first 10.

Notes

<p style="font-family:Reenie Beanie"><font size=10>
<p style="font-family: times, serif; font-size:11pt; font-style:italic">

  We did it, boys!!
</font>
</p>

  annotate("text", x = 20, y = 5, label="I'm in", color="white", family="Reenie Beanie")
  theme(text= element_text(family="Reenie Beanie", size=25))