I am trying to import fonts for ggplot2 graphs as in described here.
When I try do to so piece by piece with this code :
font_import(pattern = "Arial.ttf")
y
I get this error :
canning ttf files in C:\windows\Fonts ...
Extracting .afm files from .ttf files...
Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors = FALSE) :
arguments imply differing number of rows: 0, 1
I have checked that I have indeed the Arial font :
What is my problem
I was having the same problem, i.e. trying to import a font (Zallman Caps) using font_import()
and receiving the same error:
"Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors = FALSE) :
arguments imply differing number of rows: 0, 1"
After a lot of trial and error, I finally found a solution that worked for me and perhaps it will for you, as well.
Even though I could see the Zallman Caps font in my Windows Fonts folder and verified that it worked in Word, neither font_import()
nor list.files()
could find it there. I managed to import the font by entering the following code:
font_import(path = "C:/Users/*insert your user name*/AppData/Local/Microsoft/Windows/Fonts", pattern = ".TTF")
I have no idea why it isn't visible to R in the main fonts directory, when I can clearly see it in Windows file explorer, but at least I managed to import the font using this workaround.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With