[Rd] Fixed width graphics font?

Simon Urbanek simon.urbanek at math.uni-augsburg.de
Sat Feb 14 22:54:12 MET 2004


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



More information about the R-devel mailing list