Re: GtkCanvas requirements?



On Sun, 2007-04-22 at 21:16 +0100, Damon Chaplin wrote:
> On Thu, 2007-04-19 at 16:19 -0400, Havoc Pennington wrote:
> > Marco Pesenti Gritti wrote:
> > > There is something which bothers me though. Support for some units, 
> > > points for example, would require floating points measures. And I 
> > > suspect we don't want to do layout in floating point (instability 
> > > issues). Mozilla converts css units in twips (an arbitrary integer unit, 
> > > 1/20 of a point). That's a way to go about it I guess, though it 
> > > requires conversions it in the canvas items. Better ideas?
> > > 
> > 
> > I agree that it would be really good to avoid floating point. Pixels are 
> > by far the most intuitive thing for people using or writing items, too 
> > (since as you say they avoid having to multiply everything). Pango does 
> > have the precedent though and for convenience we could just use the same 
> > units as Pango.
> 
> I don't really think that pixels or fixed point integers are enough for
> a general purpose canvas. If people want to write complex layout apps
> like DTP/illustration packages they need more precise control over
> coordinates (and in different units like points/millimeters/inches).
> 
> e.g. the SVG spec says high quality viewers should use doubles for
> calculations:
>   http://www.w3.org/TR/SVG11/types.html#BasicDataTypes

I want to point out here that while you can specify units in points or
ems, or whatever, with a data type of fixed point numbers, 
or doubles, or whatever, you simply can't ignore the pixel grid and
expect to get good looking results; it matters whether a line is 1.5
pixels wide (a black line next to a gray line), or 2 pixels wide (a
black line.)

It was a deliberate design decision for the HippoCanvas that layout
happens in integer pixels; a get_width_request() call returns 29px or
30px, never 29.5px.

If you say that a box has a spacing of "10pt" you don't want to
interpret that as 10 * (96 / 72.) = 13.33 pixels, you want to interpret
that as 13 pixels.

Don't forget the pixel!
					- Owen

(This is, of course, different for a "widgety" use of a Canvas as
compared to a WYSYWIG use of the canvas. I'm not sure what that implies
for trying to use the same canvas for both. Maybe a global setting
or the right layered design can give sufficient flexibility.)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]