【发布时间】:2021-04-03 21:16:57
【问题描述】:
我正在使用 M1,Big Sur Macbook。我需要嵌入许多 pdf 的字体,其中包括来自 ggplot2 的图。
但是,当我运行 embed_fonts() 函数时,它返回以下错误消息:GhostScript was not found
使用Homebrew,我安装了Ghostscript。我还重新安装了extrafont 和extrafontdb,重新启动了RStudio,然后再次运行font_import() 和loadfonts()。这些都不能解决错误消息。
您遇到过这个问题吗?不知道是不是因为M1换了Apple Silicon?
我还在终端中从使用bash 切换到zsh。会不会影响到这一点?
代表:
library(ggplot2)
library(extrafont)
(plot <- ggplot(cars, aes(x = speed, y = dist)) +
geom_point())
ggsave("test_plot.pdf", plot)
embed_fonts(file = "test_plot.pdf", outfile = "test_plot_embedded.pdf")
我发现以下两个似乎相关的答案,但我不确定如何实现它们:
【问题讨论】:
-
那么,您是否定义了 R_GSCMD?
-
我不这么认为。我试图找到定义它的路径以及如何定义它。我假设我使用 Sys.setenv(R_GSCMD = "path/to/gs") 定义路径
-
直接从pages.uoregon.edu/koch安装Ghostscript时问题消失
标签: r macos ghostscript apple-m1 extrafont