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


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

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


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


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

    链接地址: http://www.djcxy.com/p/25022.html

    上一篇: 在同一个图上使用ggplot2将两个变量绘制为线

    下一篇: 无法安装xkcd字体