Re: SoC-Status 2007/08/02



On Thu, 2007-08-02 at 21:07 +0200, Mathias Hasselmann wrote:
> Am Donnerstag, den 02.08.2007, 11:24 -0400 schrieb Behdad Esfahbod:
> > On Thu, 2007-08-02 at 11:04 +0200, Mathias Hasselmann wrote:
> > 
> > > 
> > > When working on GtkVBox and vertical natural size aware alignment in
> > > GtkTable I realized GtkLabel doesn't support ellipses when rotated. So I
> > > implemented ellipsizing support for rotated labels[1]. This code only
> > > works properly for angles being multiples of 90� so far (first
> > > screencast[2]), but I managed to write some test program getting
> > > ellipses right for any angle (second screencast[3]) - just have to adopt
> > > the code to the label. 
> > 
> > That's quite impressive!  Show us the code!
> 
> git clone http://taschenorakel.de/git/playground/

Thanks.  Running it is much better than watching the screencast.
Without checking the code I think this is what you are doing: get the
non-ellipsized height of the label, then fit a box of that height at the
requested angle and calculate it's width, and ellipsize to that width.
Which is perfectly correctly for most common cases.  The case that it's
not correct is when ellipsizing reduces line height, but that's a corner
case anyway, and it's still safe as ellipsizing cannot *increase* the
line height (except in very weird corner cases).  So I'm very happy with
this approach.


> Well, but that code show single-line text by purpose!
> Multi-line support would need line-breaking callbacks in Pango.

Right.  With my API proposal in bug 435706 it should be easy enough.

> Ciao,
> Mathias

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






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