[Rd] Phonetic symbols (IPA) in R graphics

Giampiero Salvi giampi at kth.se
Thu Dec 14 11:58:33 CET 2006


Hi Paul,
I tried the following from your slides, perhaps you can see the
error:

1) I downloaded the fonts and the encoding file into the directories
   Type1 and encodings (in my current directory)
2) I ran R from the same directory (ver 2.4.0)
3) I added the font mapping for the pdf and postscript devices:

ipa <- Type1Font("InternationalPhoneticAlphabet",
                 c("Type1/tipa10.afm",
                   "Type1/tipabx10.afm",
                   "Type1/tipasi10.afm",
                   "Type1/tipabx10.afm"),
                 "encodings/silipa.enc")
pdfFonts(ipa=ipa)
postscriptFonts(ipa=ipa)

4) I created a simple figure:

plot(10,10,type="n")
text(10,10,"whatever",family="InternationalPhoneticAlphabet")

Here I get 13 warnings of the type:
"font family not found in X11 font database"
As far as I understand this is because I defined the fonts only for
the postscript and pdf devices.

5) I copy the device to postscript:

dev.copy2eps(file="whatever.eps")

Here I get the real problem:
Error in dev.copy(file = "whatever.eps", device = function (file =
ifelse(onefile,  :
        invalid character sent to 'PostScriptCIDMetricInfo' in a
single-byte locale

I googled for PostScriptCIDMetricInfo but only found a few pages in
Japanese, can you help me?

Thanks,
Giampiero

I can put the font and encoding files somewhere if necessary.
I am working on a RedHat linux computer with locale:
LANG=en_US.iso88591
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C


On Thu, 14 Dec 2006, Paul Murrell wrote:

> Hi
>
>
> Giampiero Salvi wrote:
> > Hi all,
> > I would like to add phonetic symbols in my figures. Usually I typeset
> > my documents in LaTeX and I use the tipa [1] package to get
> > International Phonetic Alphabet (IPA) fonts. So, my problem would be
> > solved if I could insert LaTeX commands in the text() function (I
> > guess at least).
> >
> > I would like to avoid using psfrag (that is, inserting a string in
> > the eps figure and then substituting it with the right symbol with
> > dvips) because I would like to work with pdf pictures and pdflatex
> > as well as latex -> dvips -> ps2pdf.
>
>
> Take a look at ...
>
> Fonts, lines, and transparency in R graphics. R News, 4(2):5-9,
> September 2004.
>
> Non-standard fonts in PostScript and PDF graphics. R News, 6(2):41-47,
> May 2006.
>
> http://www.stat.auckland.ac.nz/~paul/Talks/fonts.pdf
>
> Paul
>
>
> > If inserting special fonts is not possible at the moment, I would
> > appreciate some hints on how I could go about modifying text() to
> > include this feature. (This is why I post to r-devel instead of
> > r-help)
> >
> > Thank you!
> > Giampiero
> >
> > [1] http://www.essex.ac.uk/linguistics/clmt/latex4ling/tipa/
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



More information about the R-devel mailing list