install.packages("extrafont")
::install_version("Rttf2pt1", version = "1.3.8") remotes
4 Fonts
4.1 ttf fonts
4.1.1 Install Packages
As of August 2022, if you just install {extrafont}
as is, you will have a problem with importing fonts on Windows and there will be an error saying ‘No Font Name’. To solve this, install version 1.3.8 of {Rttf2pt1}
.
4.1.2 Download All .ttf Fonts in C:\Windows\Fonts
Folder
#will import ALL fonts, takes 5-10 min
::font_import() extrafont
4.1.3 Download Other Fonts by File
::font_import(paths = "C:/PATH/TO/FOLDER/WITH/TTF", prompt = FALSE) extrafont
4.1.4 Use
Prior to using fonts in R, need to load fonts in each session (this is like using library()
or box::use()
for a specific package)
#quiet = FALSE to remove listing of of fonts
::Loadfonts(devide = "win", quite = TRUE) extrafont
4.2 otf fonts
4.2.1 Install Packages
- issues with
{showtext}
package when in use - other ggplot2 fonts are affect when actively using this package, making the fonts smaller and making line breaks much larger
install.packages("showtext")
library(showtext)
showtext_auto()
font_add("NewFont", regular = "C://PATH//TO//NewFont.otf")
font_families()