rextrafont

How to solve the error status 5 in extrafont?


My aim is to use the font xkcd.tff. I checked that it's installed in the dir

C:/Users/prgca/AppData/Local/Microsoft/Windows/Fonts

once I

font_import(path = "C:/Users/prgca/AppData/Local/Microsoft/Windows/Fonts",
             pattern = "xkcd")

This is the output

Scanning ttf files in C:/Users/prgca/AppData/Local/Microsoft/Windows/Fonts ...
Extracting .afm files from .ttf files...
C:\Users\prgca\AppData\Local\Microsoft\Windows\Fonts\xkcd.ttf : No FontName. Skipping.
Found FontName for 0 fonts.
Scanning afm files in C:/Users/prgca/Documents/R/win-library/4.1/extrafontdb/metrics
Warning message:
In system2(enc2native(ttf2pt1), c(args, shQuote(ttfiles[i]), shQuote(tmpfiles[i])),  :
  running command '"C:/Users/prgca/Documents/R/win-library/4.1/Rttf2pt1/exec/ttf2pt1.exe" -a -G fAe "C:\Users\prgca\AppData\Local\Microsoft\Windows\Fonts\xkcd.ttf" "C:\Users\prgca\AppData\Local\Temp\RtmpSMiy86/fonts/xkcd"' had status 5

The font is, indeed, not loaded into my plots. How can I load it?


Solution

  • I suspect this is related to issues with Rttf2pt1 (upon which extrafont depends) as described here and here. Suggested solution which worked for me is to downgrade Rttf2pt1 as below:

    remove.packages("Rttf2pt1")   
    remotes::install_version("Rttf2pt1", version = "1.3.8")