[Xr] about Xr design

Carl Worth cworth at east.isi.edu
Wed Apr 23 09:04:16 PDT 2003


On Apr 22, Owen Taylor wrote:
 > On Tue, 2003-04-22 at 21:25, Davor Buvinic wrote:
 > > 
 > > My question is: why not device independent metrics, as in PostScript?. The 
 > > README file asserts that the API is based on the PostScript operators, so why 
 > > not include also the device independent metrics?
 >
 > I can't really answer this in full (not being involved in that part of
 > the design process), but what I would point out is that screen
 > resolutions are still low enough that it matters where you are with
 > respect to the pixel grid. 

Owen hit most of the main points of the original motivation I
think. 

 > If you want to draw a 1 pixel wide vertical line, you want to draw it so
 > it occupies one pixel, not half of two pixels.

And it turns out that even the device-sized grid isn't quite enough to
get you there. If you use integer device coordinates and stroke
1-pixel wide vertical/horizontal lines you will fill lines that are 2
pixels wide at 50% opacity. Yuck.

This is the reason that the default line width is 2 in Xr, (optimizing
for crisp-looking results with minimal effort, even at the expense of
resolution). Those who want crisp 1-pixel wide lines can go through
the extra effort of adjusting the endpoints by 0.5 units.

BUT, beyond all of this, Keith has an interesting suggestion for the
problem of the default unit. He proposed taking some nominal unit
size, (some "point"), and rounding it up to the nearest device pixel
size. That should meet help address the need for device independent
metrics while still allowing alignment with the pixel grid, (which
will remain important for some number of years).

If I remember correctly, Keith got this idea from CSS. I haven't read
that specification yet myself.

-Carl

-- 
Carl Worth                                        
USC Information Sciences Institute                      cworth at isi.edu





More information about the cairo mailing list