r - 如何解决extrafont中的错误状态5?

标签 r extrafont

我的目标是使用字体xkcd.tff。我检查它是否安装在目录中

C:/Users/prgca/AppData/Local/Microsoft/Windows/Fonts

曾经我

font_import(path = "C:/Users/prgca/AppData/Local/Microsoft/Windows/Fonts",
             pattern = "xkcd")

这是输出

Scanning ttf files in C:/Users/prgca/AppData/Local/Microsoft/Windows/Fonts ...
Extracting .afm files from .ttf files...
C:\Users\prgca\AppData\Local\Microsoft\Windows\Fonts\xkcd.ttf : No FontName. Skipping.
Found FontName for 0 fonts.
Scanning afm files in C:/Users/prgca/Documents/R/win-library/4.1/extrafontdb/metrics
Warning message:
In system2(enc2native(ttf2pt1), c(args, shQuote(ttfiles[i]), shQuote(tmpfiles[i])),  :
  running command '"C:/Users/prgca/Documents/R/win-library/4.1/Rttf2pt1/exec/ttf2pt1.exe" -a -G fAe "C:\Users\prgca\AppData\Local\Microsoft\Windows\Fonts\xkcd.ttf" "C:\Users\prgca\AppData\Local\Temp\RtmpSMiy86/fonts/xkcd"' had status 5

字体确实没有加载到我的图中。 我怎样才能加载它?

最佳答案

我怀疑这与 Rttf2pt1(extrafont 所依赖的)问题有关,如 here 中所述。和 here 。对我有用的建议解决方案是降级 Rttf2pt1,如下所示:

remove.packages("Rttf2pt1")   
remotes::install_version("Rttf2pt1", version = "1.3.8") 

关于r - 如何解决extrafont中的错误状态5?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72435931/

相关文章:

r - 从多列创建虚拟变量并创建新的数据框

r - 使用 extrafont 将字体导入 R 时,如何解决 "No Font Name"问题?

r - extrafont::loadfonts(device = "win") 在 Rprofile 中不起作用,但在控制台中很好

r - ggplot 中的字体系列不会改变

r - 如何使用 rollapply 根据 R 中另一列的值标记一列的值?

r - 使用 R 从列中的字符串中提取数值

r - 更改ggplot2中的字体

r - 更改R中散点图中一个点或几个点的形状

r - 使用应用函数将选定列从 POSIXct 转换为具有特定格式的日期

r - R 中 x1+x2>2*x3 的经验概率