2013-05-12 54 views
4

我正在嘗試使用ggplot2獲取在R中工作的xkcd字體。但是我遇到了一些問題。 這是我迄今爲止所做的。 1)從〜/ .fonts 目錄中的xkcd站點安裝「Humor Sans」字體2)安裝「extrafont」軟件包。該安裝工作順利。 3)當我嘗試導入的字體我碰到下面的錯誤加載庫R ggplot2字體問題

library(extrafont) 

不過。

> font_import(pattern="Humor Sans") 
Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system. 
Continue? [y/n] y 
Scanning ttf files in /usr/share/fonts/, ~/.fonts/ ... 
Extracting .afm files from .ttf files... 
Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors = FALSE) : 
arguments imply differing number of rows: 0, 1 

關於我可能做錯了什麼或我應該做什麼的任何建議? 感謝很多提前

編輯:運行Ubuntu 12.04

回答

1

你試過:

font_import(paths = "~/.fonts", pattern="Humor Sans") 

它不會出現,我認爲 「〜/ .fonts即可」 是一臺Mac的默認字體文件夾,所以如果這是(或不是)你的操作系統,你應該包括更多的細節,當你編輯你的原始問題。

+0

運行Ubuntu 12.04。這並沒有解決問題。此外,它已根據錯誤消息 – broccoli 2013-05-12 18:01:52

+1

掃描該目錄。然後,您應該在該目錄上顯示ls的結果。錯誤消息也說沒有任何匹配的模式。 – 2013-05-12 18:31:59

+0

目錄〜/ .fonts只有Humor-Sans.ttf文件。 – broccoli 2013-05-12 18:56:21