On Tue, 29 Sep 2009, Steve Bellan wrote:
> Hi,
>
> I'd like to use Arial for the font in the PDF's and TIFF's I
produce in R
As ever, it is helpful to explain why you want to do something.
First, because there may be better solutions to the larger problem,
and secondly because the answer may involve the helper in a lot of
work (as this one has), and you need to persaude them to be altruistic
by establishing a good cause.
> on my Mac (running 10.5.5). I've found the following archived help
> file on how to do it in Linux
> (http://tolstoy.newcastle.edu.au/R/e4/help/08/08/19847.html) but
That posting is about postscript(), and not about Linux per se. It
was a brief reply to an inadequately researched question.
What exact graphics device(s) are you talking about here? You seem to
have read some information about pdf(), but that does not produce
TIFFs, and tiff() has a Mac-specific backend. Indeed, TIFFs do not
contain fonts, rather bitmap images of characters.
For postscript this was somewhat moot: Arial and Helvetica are alleged
to have the same font metrics (although each seems to have various
implementations with different font metrics). See
http://en.wikipedia.org/wiki/Helvetica which says
Monotype's Arial, designed in 1982, while different from Helvetica
in some few details, has identical character widths, and is
indistinguishable by most non-specialists.
and it can be simply a matter of getting the postscript/PDF viewer to
use Arial rather than Helevetica character outlines.
It is not helped by there being many versions of 'Arial' as well as of
'Helvetica'.
> don't understand how to do this on my system. Are *.afm files
> freely available
No, font information on proprietary fonts is also proprietary.
> and do they come with the *.enc file that Type1Font() requires?
The .enc files are for encodings, and whatever Arial you have is
likely to be compatible with one of the supplied encodings. You only
need to worry about which encoding if you are using non-ASCII
text/symbols.
> if so where? Or do I convert some files I already have to *.afm?
As the posting you quoted said, you convert some files you already
have.
> I've searched around for useful info without much luck.
>
> And once I have the *.afm's & an *.enc am I correct in assuming
that I put
> them in the library/grDevices/afm directory and run the following in R:
No, you give the full paths to where you put them (and .enc files do
not go in the afm directory).
> Arial <- Typ1Font("Arial", c("4-5 afm files here"),
encoding = "enc file
> here")
>
> pdf(..., family="Arial")
You also need to arrange to embed the fonts outlines, or for your PDF
viewer to have access to them (and that's non-trivial, perhaps
impossible).
The basic issues here are
1) This is not a subject appropriate to R-help, and it has very little
to do with R. What is to be done with the postscript/PDF produced is
absolutely crucial: given the prevalence of font substitution in PDF
viewers, it is very likely that Helvetica would be shown as Arial or
v.v.
2) The differences between 'Arial' and 'Helvetica' are arcane.
If
'Helvetica' really will not do, you need specialist typographical
help.
3) 'Arial' is not a standard PDF font. If you have it on your system,
then it is a system-specific question as to how to tell your chosen R
graphics device and your graphics viewers about it. Since you are on
a Mac, you have the option of using the quartz() family of devices,
and as Arial *is* a Mac system font this is likely to be a far less
painful route.
But Mac-specific issues have an appropriate list, r-sig-mac, and you
are far more likely to get help there.
>
>
> Thanks for your help,
>
> Steve Bellan
> MPH, Epidemiology
> PhD Candidate, Environmental Science, Policy & Management
> University of California, Berkeley
>
> ______________________________________________
> 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.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595