Running embedFonts
on some EPS file I created, I get an error message:
> embedFonts("foo.ps")
Unknown device: pswrite
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
defaultdevice
Error in embedFonts("foo.ps") :
status 1 in running command 'gs -dNOPAUSE -dBATCH -q -dAutoRotatePages=/None -sDEVICE=pswrite -sOutputFile=/tmp/Rtmp3Lv0dj/Rembed2cd86df573a1 '-sFONTPATH=' 'foo.ps''
How can I avoid this error?
This is because the device is called ps2write
these days. Support for writing post script level 1 has been dropped. The next R release (we are currently at 3.1.0, so this might be about 3.2) will contain a fix. Quoting from the list of changes:
embedFonts()
now defaults toformat = "ps2write"
for.ps
and.eps
files. This is available in Ghostscript 9.x (since 2010) whereas the previous default,format = "pswrite"
, was removed in 9.10.
So the quick fix is to manually pass format = "ps2write"
to the embedFonts
invocation.