[R-SIG-Mac] Font Families and Cairo
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Mar 4 07:41:51 CET 2010
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?
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.
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.
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