[cairo] Embedding phonetic symbols in R

Sverre Stausland johnsen at fas.harvard.edu
Wed Jul 20 12:27:55 PDT 2011


Dear Cairo users,

I'm creating a plot in R with IPA phonetic symbols, using the standard
font Doulos SIL
(http://scripts.sil.org/cms/scripts/page.php?item_id=DoulosSILfont&_sc=1)

When attempting to create a pdf of this plot in R using the pdf()
function, I will get the following error messages:

> pdf(file="C:/~myplot.pdf")
> plot.default(my.x,my.y,type="n")
> windowsFonts(IPA="TT Doulos SIL")
> text(my.x,my.y,labels=my.data$words.with.IPA,family="IPA")
Error in text.default(my.x, my.y,  :
 Invalid font type
In addition: Warning messages:
1: In text.default(my.x, my.y,  :
 font family not found in PostScript font database

I've been advised that I can resolve this problem using the Cairo
package for R. But I have not succeeded. Here is my call:

> library(Cairo)
> CairoPDF(file="C:/~myplot.pdf")
> plot.default(my.x,my.y,type="n")
> windowsFonts(IPA="TT Doulos SIL")
> text(my.x,my.y,labels=my.data$words.with.IPA,family="IPA")
> dev.off()

It produces a pdf file, but all the IPA symbols come out as boxes.

Please note that R has no difficulties producing this plot in its
graphic window with IPA symbols. It's only the pdf output I'm having
difficulties with.

Any help would be appreciated! Further details follow below.

> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Cairo_1.4-9

loaded via a namespace (and not attached):
[1] tools_2.13.1

> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"


More information about the cairo mailing list