Re: FW: Text wrapping along with ellipsizing



On Tue, Jun 26, 2007 at 02:10:51AM -0700, Suma H.S wrote:
Does anyone know how to have text wrapping along with ellipsizing?
I want to have text wrapped to three lines and have ellipsis in the last
line if the text exceeds three lines.

I have used GtkLabel and set the properties for both wrapping and
ellipsizing.
The problem that I am facing is that if I try to wrap the text and
ellipsize, the text gets reduced to a single line and the ellipsis appear.

Yes, in ellipsize mode, every `paragraph' (run of text
without any forced break) is ellipsized to fit the width.

You can probably achieve this ellipsization by using the
more low-level functionality.  Iterating over
PangoLayoutLines and rendering them yourself can be a bit
too low-level, however, obtaining PangoLayoutLines and then
inserting corresponding hard newlines into the original text
and reflowing can give an acceptable result if lines are
broken only between `words' (whatever it means for the
script).  You can also try to measure the three lines, limit
the rendering area accordingly, and then uses some graphic
effect such as fade out instead of ellipsis.  Or something
like that.

Yeti

--
http://gwyddion.net/



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