Shambho
Shambho

Reputation: 3280

Not able to install xkcd fonts

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??

Upvotes: 4

Views: 3055

Answers (3)

Shambho
Shambho

Reputation: 3280

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!!

Upvotes: 2

Stedy
Stedy

Reputation: 7469

@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")

Upvotes: 0

dg99
dg99

Reputation: 5673

  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/").

Upvotes: 5

Related Questions