46

I have a folder on my Windows desktop (C:\Users\me\Desktop\Fonts) which contains fonts that I would like to import into R using extrafont.

When I try to import the fonts using

library(extrafont)
font_import(paths = "C:/Users/me/Desktop/Fonts", prompt=FALSE)

I receive the error message

Scanning ttf files in C:/Users/me/Desktop/Fonts ...
Extracting .afm files from .ttf files...
C:\Users\me\Desktop\Fonts\arista-light.ttf : No FontName. Skipping.
C:\Users\me\Desktop\Fonts\facebook-letter-faces.ttf : No FontName. Skipping.
C:\Users\me\Desktop\Fonts\Guardian-EgypTT-Text-Regular.ttf : No FontName. Skipping.
C:\Users\me\Desktop\Fonts\pico-black.ttf : No FontName. Skipping.
C:\Users\me\Desktop\Fonts\product-sans.ttf : No FontName. Skipping.
Found FontName for 0 fonts.
Scanning afm files in C:/Users/me/Documents/R/R-3.6.3/library/extrafontdb/metrics
Warning messages:
1: In system2(ttf2pt1, c(args, shQuote(ttfiles[i]), shQuote(tmpfiles[i])),  :
  running command '"C:/Users/me/Documents/R/R-3.6.3/library/Rttf2pt1/exec/ttf2pt1.exe" -a -G fAe "C:\Users\me\Desktop\Fonts\arista-light.ttf" "C:\Users\me\AppData\Local\Temp\RtmpOgbdTh/fonts/arista-light"' had status 1
2: In system2(ttf2pt1, c(args, shQuote(ttfiles[i]), shQuote(tmpfiles[i])),  :
  running command '"C:/Users/me/Documents/R/R-3.6.3/library/Rttf2pt1/exec/ttf2pt1.exe" -a -G fAe "C:\Users\me\Desktop\Fonts\facebook-letter-faces.ttf" "C:\Users\me\AppData\Local\Temp\RtmpOgbdTh/fonts/facebook-letter-faces"' had status 1
3: In system2(ttf2pt1, c(args, shQuote(ttfiles[i]), shQuote(tmpfiles[i])),  :
  running command '"C:/Users/me/Documents/R/R-3.6.3/library/Rttf2pt1/exec/ttf2pt1.exe" -a -G fAe "C:\Users\me\Desktop\Fonts\Guardian-EgypTT-Text-Regular.ttf" "C:\Users\me\AppData\Local\Temp\RtmpOgbdTh/fonts/Guardian-EgypTT-Text-Regular"' had status 1
4: In system2(ttf2pt1, c(args, shQuote(ttfiles[i]), shQuote(tmpfiles[i])),  :
  running command '"C:/Users/me/Documents/R/R-3.6.3/library/Rttf2pt1/exec/ttf2pt1.exe" -a -G fAe "C:\Users\me\Desktop\Fonts\pico-black.ttf" "C:\Users\me\AppData\Local\Temp\RtmpOgbdTh/fonts/pico-black"' had status 1
5: In system2(ttf2pt1, c(args, shQuote(ttfiles[i]), shQuote(tmpfiles[i])),  :
  running command '"C:/Users/me/Documents/R/R-3.6.3/library/Rttf2pt1/exec/ttf2pt1.exe" -a -G fAe "C:\Users\me\Desktop\Fonts\product-sans.ttf" "C:\Users\me\AppData\Local\Temp\RtmpOgbdTh/fonts/product-sans"' had status 1

Based on this I have two questions:

  1. How can I overcome the No FontName. Skipping. issue?
  2. What are the warning messages trying to tell me and do I need to be concerned about this?

I would appreciate any help, many thanks in advance!

2
  • Does this resolve your issue? Not sure since seems to be for Macs.
    – caldwellst
    Apr 14, 2020 at 9:26
  • @caldwellst Thanks for pointing that out. I came across that thread but given that it is for Macs I didn't find anything useful apart from the link to the Rttf2pt1 package. Also that thread is 7 years old, so I reckon that something might have happened since then. Apr 14, 2020 at 9:48

3 Answers 3

105

As it was mentioned by @Moritz Schwarz, the problem is traced to Rttf2pt1.

According to a solution proposed here, downgrading it to 1.3.8 will fix the problem:

library(extrafont)
library(remotes)
remotes::install_version("Rttf2pt1", version = "1.3.8")
extrafont::font_import()
5
  • 2
    Amazing!! This solved the problem! Thank you so much! I am really angry at them that they release such a damn beta. Damn new versions! And my GIS scripts also totally failing under R 4.x.x...
    – Tomas
    Aug 13, 2021 at 12:23
  • 1
    So much faster to import than getting the No font name message too!
    – Jayden
    Nov 23, 2021 at 2:28
  • 1
    This doesn't work for me. are there any other methods? Mar 22, 2022 at 12:53
  • 1
    @MelanieBaker You might want to follow the corresponding issues at extrafont's GitHub repository; e.g. github.com/wch/extrafont/issues/88 and github.com/wch/extrafont/issues/32
    – cartoonist
    Mar 22, 2022 at 14:59
  • 1
    This worked for me, but I had to make some modifications. I had to install the latest version of rtools. Then after installing Rttf2pt1, I had to restart R. Finally, I had to specify a path in the last step: font_import(paths="C:/Windows/Fonts")
    – Alex C.
    Dec 20, 2022 at 19:46
12

I had the exact same problem with one of my font files - the error always occurs in the Rttf2pt1 executable.

I created an issue on the GitHub page for the package - let's see if they can come up with a fix for this.

In the meantime, you can fix the issue though:

It seems to me that the origin of the error comes from a failure in the .ttf file. Navigate over to FontForge and download the open-source software. When installed, open your .ttf file and resave it as a .ttf using the Generate Fonts... option in the File menu. You might get a message that warns you that there is something slightly wrong with the font - you can review it if you like, but I went ahead and clicked Generate anyway.

Then you use the new .ttf file for your ttf_import() and you are good to go!! :)

2
  • 3
    Thanks for the answer, Moritz! I no longer have the need to use custom fonts in R but I trust that other users will find it useful. Hopefully they can find a fix for this! Mar 8, 2021 at 16:11
  • 1
    nothing except this solved my long-lasting problem!
    – Our
    May 24, 2022 at 14:02
5

(Writing in March 2022 from a Windows 10 machine...)

Instead of using extrafont, use the new package showtext. (https://cran.rstudio.com/web/packages/showtext/vignettes/introduction.html).

4
  • How do you download fonts with this? Like just standard ones. Apr 14, 2022 at 14:48
  • Yes. Look at the documentation. It's quite concise.
    – ap21
    Apr 16, 2022 at 10:13
  • 1
    Big caveat with using showtext: This will convert text to polygons which means you will lose the ability to edit any text in post-processing (e.g. in Illustrator, Inkscape, etc.). Here are the details on how showtext works. Jun 20, 2022 at 23:32
  • this is quite useful for my case, I can use any font as I wish with font_add_google(). thanks a lot for highlighting this package!
    – Birasafab
    Sep 14 at 10:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.