我正在使用 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")
我发现以下两个似乎相关的答案,但我不确定如何实现它们: