[R-lang] Re: Including IPA fonts in plots?

Levy, Roger rlevy@ucsd.edu
Tue Oct 5 17:37:20 PDT 2010


Michael, Adam, many thanks! Specifying the 'family' parameter has worked for plotting commands executed within the R.app GUI.

I still am having trouble generating PDF and Postscript graphs; the postscript and PDF graphics devices don't seem to know where to find the font family, e.g.

> pdf("test.pdf")
> par(family="Doulos SIL");plot(1:2,1:2);text(1.5,1.5,"ʌ")
Error in axis(side = side, at = at, labels = labels, ...) : 
  Invalid font type
In addition: Warning messages:
1: In axis(side = side, at = at, labels = labels, ...) :
  font family not found in PostScript font database
2: In axis(side = side, at = at, labels = labels, ...) :
  font family not found in PostScript font database
3: In axis(side = side, at = at, labels = labels, ...) :
  font family not found in PostScript font database
4: In axis(side = side, at = at, labels = labels, ...) :
  font family not found in PostScript font database
5: In axis(side = side, at = at, labels = labels, ...) :
  font family not found in PostScript font database
6: In axis(side = side, at = at, labels = labels, ...) :
  font family not found in PostScript font database
7: In axis(side = side, at = at, labels = labels, ...) :
  font family not found in PostScript font database

Does anyone have suggestions on how to inform these graphics devices of what to do given the font specification?

Many thanks again.

Roger


On Oct 5, 2010, at 4:30 PM, Michael Becker wrote:

> Hi Roger,
> 
> Specifying the name of a Unicode font will do the trick, e.g.:
> 
> par(family="Linux Libertine"); plot(1:2,1:2);text(1.5,1.5,"ʌ")
> or
> par(family="Doulos SIL");plot(1:2,1:2);text(1.5,1.5,"ʌ")
> 
> You'll need to have the relevant font installed, of course.
> 
> I hope this helps,
> Michael
> 
> 
> 
> On Tue, Oct 5, 2010 at 6:58 PM, Levy, Roger <rlevy@ucsd.edu> wrote:
>> Hi all,
>> 
>> Has anyone had unqualified success in rendering IPA symbols in R?  graphs I've had trouble; within the R.app GUI on OS X, the commands
>> 
>>> plot(1:2,1:2)
>>> text(1.5,1.5,"ʌ") # in case it's not rendered properly in your email client, the character is the wedge in UTF-8
>> 
>> give just a box, and I get even worse failure if I try to create a Postscript or PDF file:
>> 
>>> postscript("test.ps") # same error ensues if I use pdf("test.pdf") here instead
>>> plot(1:2,1:2)
>>> text(1.5,1.5,"ʌ")
>> Warning messages:
>> 1: In text.default(1.5, 1.5, "ʌ") :
>>  conversion failure on 'ʌ' in 'mbcsToSbcs': dot substituted for <ca>
>> 2: In text.default(1.5, 1.5, "ʌ") :
>>  conversion failure on 'ʌ' in 'mbcsToSbcs': dot substituted for <8c>
>> 3: In text.default(1.5, 1.5, "ʌ") :
>>  font metrics unknown for Unicode character U+028c
>> 4: In text.default(1.5, 1.5, "ʌ") :
>>  conversion failure on 'ʌ' in 'mbcsToSbcs': dot substituted for <ca>
>> 5: In text.default(1.5, 1.5, "ʌ") :
>>  conversion failure on 'ʌ' in 'mbcsToSbcs': dot substituted for <8c>
>> 
>> Interesting, ash (æ) renders fine on all graphics devices
>> 
>> Any suggestions would be very welcome!
>> 
>> (Stefan Evert suggested a while back that IPA fonts should just work within the R.app GUI for OS X, but I haven't found this to be the case.)
>> 
>> Best & many thanks in advance,
>> 
>> Roger
>> 
>> --
>> 
>> Roger Levy                      Email: rlevy@ling.ucsd.edu
>> Assistant Professor             Phone: 858-534-7219
>> Department of Linguistics       Fax:   858-534-4789
>> UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 
> 
> -- 
> Michael Becker
> Department of Linguistics
> Harvard University
> http://becker.phonologist.org/

--

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










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