[R] using Arial font

David Winsemius dwinsemius at comcast.net
Sun Jul 3 17:30:07 CEST 2011


On Jul 3, 2011, at 5:13 AM, Daithi Murray wrote:

> To whom it may concern,
>
> I am e-mailing you concerning the use of Arial Font in the program R  
> and I
> am using a mac.
>
> I am trying to create graphs in R and the publisher I wish to  
> publish an
> article with needs the font to be Arial. I have tried looking around  
> to find
> out how to do this with no luck and must help on the topic is geared  
> towards
> Linux users - the only help available is from the PLoS ONE site:
>

First thing I did was check to see if Arial was already in my list of  
psotscriptFonts:

names(postscriptFonts())  # Nope not there

Then I used the Mac Font Book.app to see if it was on my system. It  
is. (And it's just an ordinary sans serif font, nothing special.)   
Then I right-clicked and asked to show it in the Finder. It is in / 
Macintosh HD/Library/Fonts/Microsoft/ and is named Arial.ttf rather  
than arial.ttf and the names of the italic, bold, and bold-italic  
faces have spaces and are also capitalized.

(Now,  I cannot be sure that you will find such a font on your system.  
I have installed several MS products and it seems possible that this  
font is there only because of that. And I do not know what the  
licensing provisions are.)

I then checked using Terminal.app to see if the utility program you  
were advised to use was on my system:

david-winsemiuss-mac-pro:~ davidwinsemius$ locate ttf2afm
#  It seems to be present as a result of having installed the Tex  
package since all of the directories where it is found are descendants  
of /usr/local/texlive

>   Enable the use of Arial in R
>
>   First, convert the Arial .ttf files to afm:

This is implicitly telling you to do these actions from a system  
window such as you get with Terminal.app

I wish I could report that my efforts at following these instructions  
worked but I get the creation of zero MB files in my ~/ directory


>
>   ttf2afm /usr/share/fonts/msttcorefonts/arial.ttf > ~/arial.afm
>   ttf2afm /usr/share/fonts/msttcorefonts/ariali.ttf > ~/ariali.afm
>   ttf2afm /usr/share/fonts/msttcorefonts/arialbd.ttf > ~/arialbd.afm
>   ttf2afm /usr/share/fonts/msttcorefonts/arialbi.ttf > ~/arialbi.afm


>
>   and then do the following in R:
>
>   postscript(file="try.ps", horizontal=F,
>   onefile=F,
>   width=4, height=4,
>   family=c("/home/stephen/arial.afm",
>   "/home/stephen/arialbd.afm",
>   "/home/stephen/ariali.afm",
>   "/home/stephen/arialbi.afm"),
>   pointsize=12)
>   hist(rnorm(100))
>   dev.off()
>
> However, I do not have the above files and do not know where to get  
> them.

My advice. Use an available sans-serif font. The default sans serif  
font on the R Mac combo is Helvetica but you can ensure its use with....

 > postscript(file="try.ps", horizontal=F,
+       onefile=F,
+       width=4, height=4,
+       family="Helvetica",
+         pointsize=12)
 >   hist(rnorm(100))
 >   dev.off()
null device
           1

If the people at the other end want to use font substitution then that  
should be easily accomplished. There should be enough information in  
the ps file for their software to figure out that you used a 12-point  
sans-serif font.

(This is really a question better posed on the R-Mac-SIG mailing list  
to which I am cross-posting and to which follow-ups should be  
directed ....  without following up to rhelp.)


>
> Many thanks,
>
> D. M
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list