8
votes
library(extrafont)
setEPS()
postscript("demo.eps", width=3.3, height=3.3, onefile=FALSE, horizontal=FALSE,      paper = "special", family = "Times New Roman")
plot(rnorm(100), main="Hey Some Data")
dev.off()

I have extrafont package installed and also imported fonts and loaded the fonts for postscript device. Everything was ok. But when postscript device was started with a specific font and the plot command was given it started throwing a list of error messages which basically says "font width unknown for character 0x53" etc. I embedded the font also in the graph with extrafont command embed_fonts(). It produced a plot, but no font changes were made. But when I used cairo_ps device, it worked perfectly fine. Why is it not working with postscript device? Any help?

1
I had exactly the same issue with the pdf device using "Arial". I have run fontimport and loaded the fonts (extrafont::font_import()) after which I have imported fonts to the pdf device (extrafont::loadfonts(device = "pdf")). It could relate to an open issue with extrafont? github.com/wch/extrafont/issues/34 . Using cairopdf it also worked fine for me.FM Kerckhof
Try to use cairo_ps instead of postscript.jarauh
Yes, that is what I am usingAmritendu Mukhopadhyay

1 Answers

2
votes

Use "ArialMT" instead of "Arial" and "Times" instead of "Times New Roman", that worked for me with R 3.6.1 and ggplot in Windows 10.

https://stackoverflow.com/a/35465167/10125052