From gtk-devel Wed Nov 21 01:09:01 2007 From: Behdad Esfahbod Date: Wed, 21 Nov 2007 01:09:01 +0000 To: gtk-devel Subject: Re: Extended Layout Summary Message-Id: <1195607341.14617.30.camel () home ! behdad ! org> X-MARC-Message: https://marc.info/?l=gtk-devel&m=119560739422381 Thanks Mathias for the write-up. You didn't get much into the baseline stuff which was the really interesting part about text, but other than that, the rest looks good from that point of view. Comments below: On Tue, 2007-11-20 at 07:23 -0500, Mathias Hasselmann wrote: > > When a container widget got more space allocated than requested, it > considers the difference between natural and requested size of its > children to distribute that additional space, in relation to the child's > difference between natural and minimum-size. Let's use an example for > demonstration: > > Assume we have a container with two children. Both children request > a_min = b_min = 50 pixels as minimum size. The first child announces > a_nat = 100 pixels, the second announces b_nat = 200 pixels as > natural size. > > This gives a requested size of c_min = 100 pixels, and a natural > size of 300 pixels (c_nat) for the container. Now the container gets > allocated at a size of 200 pixels (c_cur). This are 100 pixels to > distribute (c_gap). > > So the first child gets: > > a_cur = a_min + c_gap * (a_nat - a_min) / (c_nat - c_nat) > = 50 + 100 * 50 / 200 > = 75 pixels. > > The second child gets: > > b_cur = b_min + b_gap * (b_nat - b_min) / (c_nat - c_nat) > = 50 + 100 * 150 / 200 > = 125 pixels. Something that Ryan brought up, and I was hoping that Havoc answer is that the above algorithm is not optimal, you can easily do better. Quoting Havoc's words: "bring smaller items up to natural size first". Read his entire "TEXT LAYOUT THAT WORKS PROPERLY?" post here: http://log.ometer.com/2006-10.html That, and switching to the API Havoc suggested would mean that Gtk+ will be in par with HippoCanvas which is cool. Cheers, -- behdad http://behdad.org/ "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety." -- Benjamin Franklin, 1759 _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list