From simon.urbanek at math.uni-augsburg.de  Sat Feb 14 22:54:12 2004
From: simon.urbanek at math.uni-augsburg.de (Simon Urbanek)
Date: Sat Feb 14 22:54:28 2004
Subject: [Rd] Fixed width graphics font?
In-Reply-To: <402E74AA.8080502@stat.auckland.ac.nz>
References: <D7A3CFD7825BD6119B880002A58F06C20680AEB9@groexmb02.pfizer.com>
	<cefo20penr0vup0uq75aq8io7uqbdkd9r1@4ax.com>
	<x21xoz2r5v.fsf@biostat.ku.dk>
	<C35F034D-5E12-11D8-9AAC-000A957CEFBA@math.uni-augsburg.de>
	<402E74AA.8080502@stat.auckland.ac.nz>
Message-ID: <533C4F7E-5F38-11D8-8A58-000A959F327E@math.uni-augsburg.de>

On Feb 14, 2004, at 8:19 PM, Paul Murrell wrote:

> I have added fontfamily to the "graphics context" information that can 
> be passed from the graphics engine to graphics devices.  Two rather 
> important things remain to be done:
>
> (i) the devices need to do something with this information.  As Duncan 
> Murdoch pointed out, Windows already allows something similar via a 
> device-specific approach to the existing font parameter.  I have 
> suggested (but not yet tried to implement) a more device-independent 
> approach in http://www.stat.auckland.ac.nz/~paul/R/gpars.html (linked 
> off the "R Developer" web page).  I haven't really had feedback on 
> this suggestion yet and I intended to elicit more before hacking any 
> code.

I'm quite fond of the new R_GR_gcontext approach. As of fonts, the 
fontdb idea sounds good to me, too. The alternative would be similar to 
what Java does: define generic types like "Serif" as strings and 
interpret anything else as device specific (but fontdb seems cleaner to 
me, because R can compute on the list).

The only thing I'm not quite sure about is the alpha handling. I don't 
know if I got this right, but wouldn't an alpha slot (or slots) collide 
with the RGBA specification? I mean: what is the result of 
col=0x80808080, colalpha=0.5 supposed to be? IMHO adding alpha as 
additional parameter to rgb and friends sounds appealing to  me and 
preferable to additional gc entries. I would argue that col="red" is 
fully opaque red and if you need alpha, you need to specify it in an 
another way (not all devices support alpha anyway...). However 
col="#0000ff80" should be easy to support, too. Additional alpha flag 
in gc would have the benefit of easily obtainable "ghost" plots, but 
the question is whether this would not be better handled by the R side 
and not the device side...

> (ii) the graphics systems (base and grid) need to allow the user to 
> set this information.  grid has a fontfamily gpar, but base has 
> nothing yet.  Again a suggested implementation is in 
> http://www.stat.auckland.ac.nz/~paul/R/gpars.html and there is a bit 
> more in http://www.stat.auckland.ac.nz/~paul/R/fonts.html

No objections here - it sounds like a sensible proposal to me...

Just my ?0.02  ...

Simon


[Rd] Fixed width graphics font?
Simon Urbanek