So close. The first version should work if you switch the order of the postscript() and par() functions:
Arial <- Type1Font(family="Arial", metrics=c("ArialMT.afm", "arial-BoldMT.afm", "Arial-ItalicMT.afm", "Arial-BoldItalicMT.afm")) postscriptFonts(Arial=Arial) par(family="Arial") postscript("testArial.eps", horizontal=F, onefile=F, width=4, height=4) plot(1:10, 1:10) dev.off() ---------------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sharon Kuhlmann-B Sent: Thursday, February 09, 2012 4:53 AM To: r-help@R-project.org Subject: [R] Arial font in eps figures in R Hi, I am trying to create a graph using Arial font (as required by PLoS One). I have read probably all posts in R-help on this topic, as wells as R-news 2006. The code I have been trying is following: Arial <- Type1Font(family="Arial", metrics=c("ArialMT.afm", "arial-BoldMT.afm", "Arial-ItalicMT.afm", "Arial-BoldItalicMT.afm")) postscriptFonts(Arial=Arial) postscript("testArial.eps", horizontal=F, onefile=F, width=4, height=4) par(family="Arial") plot(1:10, 1:10) dev.off() but getting the following error message: Error in axis(side = side, at = at, labels = labels, ...) : family 'Arial' not included in PostScript device Alternatively I've also tried: Arial <- Type1Font(family="Arial", metrics=c("ArialMT.afm", "arial-BoldMT.afm", "Arial-ItalicMT.afm", "Arial-BoldItalicMT.afm")) postscriptFonts(Arial=Arial) postscript("testArial.eps", horizontal=F, onefile=F, width=4, height=4, family="Arial") plot(1:10, 1:10) dev.off() which resulted in: Error in postscript("testArial.eps", horizontal = F, onefile = F, width = 4, : Failed to initialise default PostScript font The *.afm files were downloaded from http://www.koders.com/, since I wasn't able to run ttf2afm or ttf2pt1 on my computer. The files are saved under ../R/library/grDevices/afm. I have also tried saving the files with LF line endings (instead of CRLF) as indicated in README under /grDevices/afm, and zipping them. That didn't make a difference. I am currently running R-2.14.1 on Windows7. If I run postscriptFonts(), the Arial font is included in the list, very much as other types of fonts. I've seen that some R packages are now using arial as default (e.g. googleVis and R2PPT) but I cannot see how it is done. Thanks in advance for any suggestions. /Sharon ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.