[R-lang] Re: Embedding phonetic symbols in R

Levy, Roger rlevy@ucsd.edu
Wed Jul 20 12:47:53 PDT 2011


Hi Sverre,

You might find the following thread useful:

 http://pidgin.ucsd.edu/pipermail/r-lang/mailman.ucsd.edu/pipermail/ling-r-lang-l/2010-October/000110.html

For me a crucial part of the puzzle was using the cairo_pdf and cairo_ps drivers (kudos to Paul Metzner for pointing this out).

Best & let us know if that helps!

Roger

On Jul 20, 2011, at 1:33 PM, Sverre Stausland wrote:

> Hi all,
> 
> I'm sure I'm not the only Windows user out there trying to embed IPA
> symbols in R graphics and then make a pdf out of it. If anyone knows
> how to do that, I would appreciate some help. Because I have not
> succeeded.
> 
> Here is what I have tried. 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"

--

Roger Levy                      Email: rlevy@ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://idiom.ucsd.edu/~rlevy












More information about the ling-r-lang-L mailing list