0

我正在使用 M1,Big Sur Macbook。我需要嵌入许多 pdf 的字体,其中包括来自ggplot2.

但是,当我运行该embed_fonts()函数时,它返回以下错误消息:GhostScript was not found

有了Homebrew,我安装了Ghostscript。我也重新安装了extrafontextrafontdb,重新启动,RStudio然后再次运行。这些都不能解决错误消息。font_import()loadfonts()

你遇到过这个问题吗?我想知道是不是因为 M1 的 Apple Silicon 发生了变化?

我也在终端中从使用切换bashzsh。这可能会影响到这一点吗?

一个代表:

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 中检查包时修复“无法找到 GhostScript 可执行文件以运行大小减小检查”错误?

R 无法识别 GhostScript 以嵌入 eps 图

4

1 回答 1

0

当我直接安装 Ghostscript https://pages.uoregon.edu/koch/(Ghostscript 9.54.0)时,我的问题得到了解决

至少在我看来,使用homebrew install ghostscript. 当我在终端中运行它时,一切似乎都很好。没有错误信息。

于 2021-04-04T11:22:31.133 回答