[R-SIG-Mac] Font Families and Cairo

Ben Madin lists at remoteinformation.com.au
Thu Mar 4 09:33:37 CET 2010


G'day there, thanks for the comprehensive response.

On 04/03/2010, at 14:41 , Prof Brian Ripley wrote:

> Your example is not reproducible, but png() does support transparent backgrounds and you did not specify one (by bg="transparent").  The native method on a Mac would be png(type="quartz"): have you tried that?

Neat - I wasn't aware of that. I am trying to avoid Mac specific solutions as the scripts are also running on a FreeBSD server using PL/R, and I was hoping to swap them back and forward as simply as possible.

> Yes, there are known problems with cairo font handling on Macs: some of them have been overcome in R's builtin cairo support, including in the default type="cairo" for png.
> 
> Given that 'cairo' (as in cairographics.org, their preference is not to capitalize) is a third-party graphics system, it is rather ambiguous as to whether you meant R's builtin support or the contributed package Cairo (library(Cairo) appears nowhere in your code): I am presuming the latter for which incorrect use of italics is a known (and reported) problem.

OK, apologies - my ambiguity is more than likely due to my not understanding the difference. The only reference I found that approximated my problem was on this list, and it wasn't conclusive, hence my post to this list.

> Finally, Cairo is a contributed package, and the posting guide suggests writing to the author/maintainer first.  As that is Simon U, he does read this list but in many other instances that would not be the case.

ibid

cheers

Ben

> 
> On Thu, 4 Mar 2010, 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.
>> 
>> 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).
>> 
>> cheers
>> 
>> Beb
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>> 
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-SIG-Mac mailing list