wch / extrafont

Tools for using fonts in R graphics
312 stars 49 forks source link

Font is embeded, but i can not document properly #99

Open msgoussi opened 1 year ago

msgoussi commented 1 year ago

Hi.. When I run the below the code, and open pdf file, the font is not embeded. Please advise

Sys.setenv(R_GSCMD = "C:/GhostScript/gs10.01.1/bin/gswin64c.exe")

library(extrafont)

extrafont::font_import()

Register the fonts with R

loadfonts(device = "all")

library(ggplot2)

ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + ggtitle("Title text goes here") + theme(text = element_text(size = 16, family = "Impact"))

ggsave("myplot.pdf", width = 4, height = 4)

embed_fonts("myplot.pdf")

image

image

however when i used ggsave("myplot.pdf", width = 4, height = 4, device = cairo_pdf)

it works perfectly