4

I was trying the xkcd font as per the instructions given in the vignette: vignette("xkcd-intro")

However get an error on the following step:

> system("cp xkcd.tff -t ~/.fonts")
cp: xkcd.tff: No such file or directory
cp: -t: No such file or directory

What to do??

Shambho
  • 3,250
  • 1
  • 24
  • 37

3 Answers3

5
  1. Are you sure it's not supposed to be xkcd.ttf instead of xkcd.tff?

  2. I'm fairly certain that cp SOURCE OPTION DESTINATION is not a legal use of cp on any Unix system. In fact, since you're copying only one file, you don't even need the -t option. It should probably just be system("cp xkcd.ttf ~/.fonts/").

dg99
  • 5,456
  • 3
  • 37
  • 49
  • 1
    Thanks. Correct on both accounts! The installation instructions need to be updated. Just [notified the author](http://stackoverflow.com/questions/12675147/how-can-we-make-xkcd-style-graphs-in-r/16597217#16597217)!! – Shambho Apr 22 '14 at 23:50
  • This removed the error, but fonts were not copied!! My own answer is pasted below!! – Shambho Apr 25 '14 at 05:31
2

After a lot of trial and error, I was able to get it to work myself. Essentially, you have to copy the downloaded font file to all the folders in font.paths().

On OS X:

for(dirs in font.paths()) {
    file.copy(file.path(dirs,"xkcd.ttf"), "~/Library/Fonts/")
}

And it's working!!

CousinCocaine
  • 591
  • 6
  • 20
Shambho
  • 3,250
  • 1
  • 24
  • 37
0

@dg99 is correct but the issue is that the filename changes in the documentation

download.file("http://simonsoftware.se/other/xkcd.ttf", dest="xkcd.ttf", mode="wb")
system("cp xkcd.tff -t ~/.fonts")

Change the second line to: system("cp xkcd.ttf -t ~/.fonts")

Stedy
  • 7,359
  • 14
  • 57
  • 77