[R-SIG-Mac] Font Families and Cairo

Simon Urbanek simon.urbanek at r-project.org
Thu Mar 4 15:20:44 CET 2010


On Mar 4, 2010, at 0:47 , Ben Madin wrote:

> G'day all,
>
> I am using Cairo to produce output graphics (mainly png), but don't  
> seem to be able to figure out how to stop the text being rendered in  
> italics.
>

This is a known issue in how freetype+fontconfig cannot agree on the  
right traits in some cases if font suitcases are involved on some  
versions of OS X. You can force the default fonts to specific names  
using CairoFonts, e.g. the following is known to work:

CairoFonts 
("Arial:style 
=Regular","Arial:style=Bold","Arial:style=Italic","Helvetica","Symbol")

If that doesn't help, make sure you have Arial enabled or use a  
different font.

Cheers,
Simon



> I am using 10.6.2, and R version 2.10.1 Patched (2010-02-01 r51089).
>
> Using this produces the output as I anticipated (with upright text)
>
> png('outputs/reports_by_province2.png')
> barplot(outbreaks.summary$Provinces,names.arg=outbreaks.summary 
> $Year, ylab='Number of provinces reporting outbreaks', cex.axis=1,  
> cex.names=1) -> tmp
>
> Using this produces a nicer image (the transparent background is  
> important), but the text is all italicised
>
> Cairo(950,450, 'outputs/reports_by_province.png')
> barplot(outbreaks.summary$Provinces,names.arg=outbreaks.summary 
> $Year, ylab='Number of provinces reporting outbreaks', cex.axis=1.2,  
> cex.names=1.2) -> tmp
>
> I can change the family, ie :
>
>> par('family')
> [1] "serif"
>
> but Cairo doesn't seem to respect it (I'm actually wanting Helvetica  
> so it doesn't matter), but I can't fix the font (and I note from the  
> docs:
> 	fonts	see pdf, ignored, Cairo automatically detects and embeds fonts
> )
>
> So I'm wondering if it is just my installation, a known issue or  
> I've missed the workaround (using CairoFonts hasn't changed it).
>

Are you sure? Please try the above.


> cheers
>
> Beb
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>



More information about the R-SIG-Mac mailing list