3

Because of the issue raised in Using Unicode inside R's expression() command, I am switching to R on Mac OS X to create some plots. Using CairoPDF(), however, the commands I use in Windows to select my fonts don't have any effect on Mac OS X, where the output .pdf file always has the Helvetica font.

library(package = "Cairo")
CairoPDF("test.pdf")
plot.new()
text(x=.5,y=.5,labels="\u0260",family="Times New Roman")
dev.off()

The output in Windows is:

enter image description here

The output in Mac OS X is:

enter image description here

The Times New Roman font is exactly the same on both systems.

Community
  • 1
  • 1
Sverre
  • 747
  • 2
  • 8
  • 19

1 Answers1

3

I did it with CairoFonts rather than the family argument, which seems to be getting ignored.

> CairoPDF("test.pdf")
> plot.new()
> text(x=.5,y=.5,labels="\u0260",family="Times New Roman")
> dev.off()
quartz 
     2 

enter image description here

> CairoFonts(  # slight mod to example in ?CairoFonts page
+   regular="TimesNewRoman:style=Regular",
+   bold="FreeSans:style=Bold",
+   italic="FreeSans:style=Oblique",
+   bolditalic="FreeSans:style=BoldOblique"
+ )
> 


> CairoPDF("test.pdf")
> plot.new()
> text(x=.5,y=.5, labels="\u0260" )
> dev.off()
quartz 
     2 

enter image description here

IRTFM
  • 258,963
  • 21
  • 364
  • 487