尽管可用,但 InDesign 无法识别 R-plot 中的嵌入式 pdf 字体

Embedded pdf-font in R-plot is not recognized by InDesign although available

使用 ggplot2extrafont 和 R 的 pdf 设备,我在 cmyk 颜色模型中构建了包含某些非 Windows 字体的绘图。 pdf 输出看起来不错,显示字体已正确嵌入,例如 "Arial-BoldMT".

不幸的是,在尝试将 pdf 导入 Adob​​e InDesign 时,我收到错误消息,指出字体 "Arial-BoldMT" 当前不可用,我提到的非 Windows 字体也会出现这种情况以上。

我想 InDesign 无法识别嵌入字体的名称可能存在问题,因为该字体作为 "Arial" 非常可用,包括所有变体,例如 "bold" .

关于如何通过调整 R 脚本或使用 InDesign 让这些字体在 InDesign 中工作有什么建议吗?

谢谢!

这是一个示例图,类似于我需要制作的图,只是省去了不必要的代码行:

library(ggplot2)
library(extrafont)

# define font
font <- "Arial"

# sample data
x <- data.frame(c("Personnel Costs", "Non-Personnel Costs", "Investments"),
                c(33, 22, 45))
colnames(x) <- c("costs", "percent")

# plot
plot <- ggplot(x, aes("", y = percent, fill = factor(costs), width = 1.2))+
  geom_bar(width = 4, stat="identity")+
  # add the text (no font specification here)
  geom_text(aes(label=costs),fontface = "bold")+
  # no legend
  theme(legend.position = "none") +
  # pie-chart
  coord_polar("y", start = 0.42, direction = 1)

# save plot
pdf("plot.pdf", family=font, colormodel="cmyk")
plot
dev.off()

PS:使用 ggsaveembedFonts() 与 Ghostscript 产生相同的结果。

注意:在 pdf 设备上使用 "Calibri" 或 ggsaveembed_fonts() 根本不起作用。

似乎字体没有正确嵌入到 pdf 中。 通过 运行 embed_fonts() 保存绘图后,嵌入了相应的字体,现在可以在 InDesign 中使用了。

我只需要:

library(extrafont)
embed_fonts(file="plot.pdf", outfile="plot.pdf")