[R] Symbol Font Baseline, Cairo, Card Symbols

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


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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list