wch / extrafont

Tools for using fonts in R graphics
315 stars 48 forks source link

embed_fonts fails (Mac, R 3.0) #27

Closed jxchong closed 11 years ago

jxchong commented 11 years ago

embed_fonts fails:

embed_fonts("xxxx/temp.pdf", outfile="xxxx/temp_embed.pdf") Error: /undefinedfilename in ('xxxx/temp.pdf') Operand stack:

Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push Dictionary stack: --dict:1156/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)-- Current allocation mode is local Last OS error: 2 GPL Ghostscript 9.05: Unrecoverable error, exit code 1 Error in embedFonts(file = file, format = format, outfile = outfile, options = paste(paste("-I", : status 1 in running command '/usr/local/bin/gs -dNOPAUSE -dBATCH -q -dAutoRotatePages=/None -sDEVICE=pdfwrite -sOutputFile=/var/folders/qw/38815kvs6gl5h_q2jxl4wmcm0000gn/T//RtmptQaKe8/Rembed7793151304e5 '-sFONTPATH=' -I'/Users/jxchong/Library/R/3.0/library/extrafontdb/fontmap' "'xxxx/temp.pdf'"'

However I can fix up the command and run it manually via command line:

/usr/local/bin/gs -dNOPAUSE -dBATCH -q -dAutoRotatePages=/None -sDEVICE=pdfwrite -sOutputFile=xxxx/GB_embed.pdf '-sFONTPATH=' -I'/Users/jxchong/Library/R/3.0/library/extrafontdb/fontmap' 'xxxx/temp.pdf'

1) too many quotes around the input file in the embed_fonts command (nested double and single quotes) 2) the output file is being sent to a temporary directory even though I specified it with outfile

wch commented 11 years ago

I just sent a new version 0.14 to CRAN. Can you try that version out? It needs to be installed with devtools:

install.packages('devtools')
devtools::install_github('extrafont', 'wch', 'v0.14')

If that doesn't fix it, I have an idea of how to address it.

jxchong commented 11 years ago

devtools successfully loaded the update but that didn't fix it (same command is generated as before)

wch commented 11 years ago

Can you try this version?

install.packages('devtools')
devtools::install_github('extrafont', 'wch', 'embedfont-space')
jxchong commented 11 years ago

That worked! Thanks!

dougmitarotonda commented 11 years ago

So, sorry if I am being dense here, but I am still getting this same error and I have v0.14 (and R 3.0) installed. Plus, the github installation suggested by Winston is getting a server error (perhaps you took it down?). I am not sure what I am doing wrong...

wch commented 11 years ago

@dougmitarotonda I removed the branch. Try installing the latest devel version with:

devtools::install_github('extrafont', 'wch')

It'll be a few more days before I can submit a new version to CRAN without them getting angry about too-frequent updates...

dougmitarotonda commented 11 years ago

Thanks so much @wch, works perfectly now.