[R] How to enable Arial font for postcript/pdf figure on Windows?
Camille
c.pelat at imperial.ac.uk
Fri Dec 10 12:20:23 CET 2010
Hi Agnes,
I converted the Arial font files from ttf to afm using ttf2afm from MikTex
complete installation.
When used in R with the line recommended by Plos, they seem to give correct
Arial font graphics: I checked by opening the ps file with a viewer
(gsview), a text editor (notepad++) and Adobe illustrator.
However I did not try (but hopefully will do soon) the ultimate test:
submission to Plos.
Here is a way to do it: (Mind the trick at step 5)
1) Download ttf2afm.exe (available for ex in the install directory of MikTex
complete installation)
2) Fetch the arial ttf files in C:\Windows\Fonts
3) Place ttf2afm.exe and the ttf files in a directory (eg C:/ttf2afm/)
4) Open a DOS window (using cmd). Place yourself into the created directory
(using cd). Then type
ttf2afm.exe arial.ttf > arial.afm
ttf2afm.exe arialbd.ttf > arial-Bold.afm
ttf2afm.exe ariali.ttf > arial-Oblique.afm
ttf2afm.exe arialbi.ttf > arial-BoldOblique.afm
5) Now, if you used ttf2afm.exe from MikTex you should open the created afm
files with a text editor (ex Notepad++) and correct the following things:
• Remove the copyright line (or make it start zith comment and get rid of
the (c) copyright symbol )
• At the beginning of 4 of the first lines, the variable name is missing, so
add it. Eg in arial.afm:
o FontName ArialMT
o FullName Arial
o FamilyName Arial
o Weight Normal
Now you can use these fonts with the postscript function in R with the
following line:
postscript(file="try.ps", horizontal=F, onefile=F, width=4, height=4,
pointsize=12,
family=c (
“C:/ttf2afm/arial.afm",
“C:/ttf2afm/arial-Bold.afm ",
“C:/ttf2afm/arial-Oblique.afm ",
“C:/ttf2afm/arial-BoldOblique.afm "
)
)
hist( rnorm(100) )
dev.off()
Cheers,
Camille
--
View this message in context: http://r.789695.n4.nabble.com/How-to-enable-Arial-font-for-postcript-pdf-figure-on-Windows-tp3017809p3081774.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list