Using custom OTF fonts in ggplot2

后端 未结 2 1198
野趣味
野趣味 2021-02-02 16:23

I need to use a custom font, namely \"Archer\", with ggplot2 in R. Archer is an otf typeface installed on my system (Mac OSX Yosemite).

This script (found here: Modifyin

2条回答
  •  暖寄归人
    2021-02-02 16:58

    You'll need to convert Archer from an OTF to a TTF. From extrafont's github readme:

    Presently it allows the use of TrueType fonts with R

    I'm amused---I had to do this because my organization also uses Archer. The first hit for this search is purple, so probably that's what I used and it worked just fine.

    When having trouble with extrafont it can also be useful to check the available options with fonts(). Then you can verify that your import was successful.

    If you save your plot to a PDF, to make sure to embed the fonts as well, using grDevices::embedFonts or extrafont::embed_fonts.

提交回复
热议问题