[R] Symbol Font Baseline, Cairo, Card Symbols

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Aug 17 18:15:22 CEST 2011


On Wed, 2011-08-17 at 08:06 -0700, ivo welch wrote:
> hi gavin---I am not even sure that it is a cairo bug, much less do I
> know about the details where it sits.  for all I know, it could be an
> Apple problem. the "possible bug report" was not only for the cairo
> package (what's the difference between a package and a library?  in my
> user R code, I invoke it as library(cairo)), but also for others who
> may use it and be surprised when they run into the same issue,
> wondering if it is their code, or a more general issue..

In the real world, libraries contain books. In the R world, libraries
contain packages. In the same way that in the real world it would be
silly and wrong to call a book a library, it is wrong to call an R
package a library.

The "thing" that resides on CRAN is the R *package* named Cairo. It
works by making use of a general purpose *software* *library* called
Cairo, details of which can be found here
http://www.cairographics.org/ .

I appreciate that the name of the `library()` function used to load
packages for use is somewhat counter-intuitive, but there you go. There
is talk of moving to a `use()` function to replace `library()`; when/if
that happens, perhaps it will lessen the confusion.

Even if you are not sure, the general advice is to email the
maintainers. If there is nothing wrong and this is a quirk of
fonts/system/OS etc then your archived email lives on via Google and may
confuse others in the future. Giving package authors a chance to look at
the problem is also common courtesy. The Posting Guide is clear in this
regard:

If the question relates to a contributed package , e.g., one downloaded
from CRAN, try contacting the package maintainer first.

Many people ignore this however.

G

> /iaw
> 
> ----
> Ivo Welch (ivo.welch at gmail.com)
> 
> 
> 
> 
> 
> On Wed, Aug 17, 2011 at 5:18 AM, Gavin Simpson <gavin.simpson at ucl.ac.uk> wrote:
> > On Tue, 2011-08-16 at 17:46 -0700, ivo welch wrote:
> >> I think I found a bug in the Cairo library, plus weird behavior in
> >> both the Cairo and the normal pdf device.  The baseline of the spades
> >> symbol seems to be off.  This is easier to show than it is to explain.
> >>  The problem does not appear in the normal pdf device, which is why I
> >> am guessing this is a Cairo bug.  moreover, I cannot figure out why
> >> three of the card symbols seem to be transparent, but the fourth is
> >> not.  this is the case for both the Cairo and the ordinary pdf
> >> devices.
> >>
> >> I thought I would report it to the R wizards on this group...
> >
> > Why? One is expressly asked to address such problems with the package
> > maintainer(s), especially if you feel there is a bug in the package.
> >
> > And whilst Martin M is potentially indisposed at UseR! 2011, I will
> > mention that it is a *package* not a library when you refer to the R
> > package Cario. If you had identified a bug in the Cairo *library* you
> > should be reporting it upstream to the Cairo people:
> > http://www.cairographics.org/
> >
> > G
> >
> >> library(Cairo)
> >>
> >> clubs <- expression(symbol('\247'))
> >> hearts <- expression(symbol('\250'))
> >> diamonds <- expression(symbol('\251'))
> >> spades <- expression(symbol('\252'))
> >> csymbols <- c(clubs, diamonds, hearts, spades)
> >>
> >> CairoPDF(file = "cardsymbols.pdf")
> >>
> >> plot( 0, xlim=c(0,5), ylim=c(0,2), type="n" )
> >> clr <- c("black", "red", "red", "black")
> >> for (i in 1:4) {
> >>   hline <- function( yloc, ... ) for (i in 1:length(yloc)) lines(
> >> c(-1,6), c(yloc[i],yloc[i]), col="gray")
> >>   hline(0.9);  hline(1.0);   hline(1.1);   hline(1.2)
> >>   text( i, 1, csymbols[i], col=clr[i], cex=5 )
> >>   text( i, 0.5, csymbols[i], col=clr[i] )
> >> }
> >>
> >> dev.off()
> >>
> >>
> >>
> >> ----
> >> Ivo Welch (ivo.welch at gmail.com)
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> > --
> > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> >  Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
> >  ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
> >  Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
> >  Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
> >  UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
> > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> >
> >

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list