I had been looking for information about including OSX fonts in R
plots for a long time and never quite found the answer.  I spent an
hour or so gathering together the following solution which, as far as
I have tested, works.  I'm posting this for feedback and and
archiving.  I'd be interested in any caveats about the brittleness of
the technique.

Thanks.

F

-----

1. Find font
        system font path: /Library/Fonts/
2. Extract ttf (if necessary) with fondu [http://fondu.sourceforge.net/]
        eg, fondu -force Optima.dfont
3. ttf2asm for each ttf file, stripping the Copyright and warning
3. copy files to
        RHOME/library/grDevices/afm
        (usually,
        
/Library/Frameworks/R.framework/Versions/2.5/Resources/library/grDevices/afm
        )
4. R code to use the font; eg,
        newfont= 
Type1Font("Optima",c("OptimaRegular.afm","OptimaBold.afm","OptimaItalic.afm","OptimaBoldItalic.afm"))
        pdf("newfont.pdf",version = "1.4",family=newfont)
        plot(rnorm,col="red")
        dev.off()

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to