I am trying to create an (encapsulated) Postscript graphic with fonts embedded in the file. For embedding, I use the extrafont
package.
While the actual graphic created by the postscript()
device is completely fine, embed_fonts()
seems to change the paper size to something like A4 or Letter. Why is that? Is there a way to maintain the paper size set by the postscript()
device?
Here is a minimal example:
library(extrafont)
postscript( "test.eps", family="Times New Roman", width=4, height=4,
horizontal = FALSE, onefile=FALSE, paper = "special")
plot(1:10)
dev.off()
embed_fonts("test.eps")
Running this example without the call to embed_fonts()
results in a figure with appropriate dimensions (i.e., the desired output). Here is a screenshot from my document viewer:
However, as soon as embed_fonts()
is run on this file, the paper size is changed to a fixed paper size:
Is there a way around this? Both embedding the fonts and using .eps is necessary. I suspect it may have to do with the information which is saved in the Postscript file when paper="special"
(or the lack thereof). It seems as if embed_fonts()
would reset this information on its own.