I've seen a lot of suggestions but to my frustration I can't seem to save a simple pdf plot using a different font in ggplot2. I am using ggplot version 3.3.5 in R version 4.1.3 from within Rstudio 2022.07.1 on a mac.
All I use to change the font in my ggplot code is theme(text = element_text(family = "AppleGothic")
.
It looks fine from within Rstudio. But when I export to pdf, the resulting file is completely blank. Not just the text, but everything. If I try instead
ggsave("/path/", fig, device = 'pdf')
I get the error message
error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : failed to find or load PDF CID font
I would greatly appreciate any help on this issue.