【问题标题】:GhostScript was not found with extrafont没有找到带有 extrafont 的 GhostScript
【发布时间】:2021-04-03 21:16:57
【问题描述】:

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

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

使用Homebrew,我安装了Ghostscript。我还重新安装了extrafontextrafontdb,重新启动了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")

我发现以下两个似乎相关的答案,但我不确定如何实现它们:

How to fix "Unable to find GhostScript executable to run checks on size reduction" error upon package check in R?

R does not recognize GhostScript to embed eps plots

【问题讨论】:

  • 那么,您是否定义了 R_GSCMD?
  • 我不这么认为。我试图找到定义它的路径以及如何定义它。我假设我使用 Sys.setenv(R_GSCMD = "path/to/gs") 定义路径
  • 直接从pages.uoregon.edu/koch安装Ghostscript时问题消失

标签: r macos ghostscript apple-m1 extrafont


【解决方案1】:

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

看来,至少在我这边,使用homebrew install ghostscript 存在问题。当我在终端运行它时,一切似乎都很好。没有错误消息。

【讨论】:

    猜你喜欢
    • 2013-05-21
    • 2015-08-24
    • 2022-01-26
    • 2015-04-20
    • 1970-01-01
    • 1970-01-01
    • 2012-11-28
    • 2015-01-22
    • 1970-01-01
    相关资源
    最近更新 更多