After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 327996 - Ellipsizing wrapped text
Ellipsizing wrapped text
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2006-01-21 16:19 UTC by Behdad Esfahbod
Modified: 2018-05-22 12:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Behdad Esfahbod 2006-01-21 16:19:18 UTC
Pango should have a way to ellipsize wrapped text and do that correctly.  That is, to tell it to ellipsize text to two lines for example, so you get something like:

+---------------------+
|This is a long text  |
|that is ellipsized...|
+---------------------+
Comment 1 Behdad Esfahbod 2006-01-21 16:19:42 UTC
Thinking about it, it may be done by setting a height on the layout, like we set width...
Comment 2 Owen Taylor 2006-01-22 19:10:14 UTC
I was initially thinking about implementing this when I was doing the
current ellipsization support, but decided that it was going to make
an already difficult job considerably harder. Especially if you support
all the ellipsization positions.

(Any position other than end is probably best done as a two-pass operation ...
shape the entire layout, then go back and eliminate lines, then ellipsize
the omitted text into a single line.)
Comment 3 Tapani Pälli 2006-01-23 11:52:31 UTC
Adding myself to CC to track this, Maemo platform is interested to have this feature.
Comment 4 Gene Z. Ragan 2006-12-11 00:48:32 UTC
Nautilus bug 84390 could really use multi-line truncation in order to address icon layout improvements.  I looked process_line() in pango_layout.c at some ideas, but your basic plan as described above seems sound.  Adding start and end truncation seems very manageable.  I think middle truncation should actually truncate the last line in the middle.  In my previous experiments, this looked pretty good and seemed to convey the maximum amount of information.

Thanks!
Comment 5 Steve Tousignant 2007-01-26 04:11:49 UTC
As Gene Z. Ragan said. It would be a useful in resolving bug 84390. I've tried a solution but pango code got me completely lost. 

I'm adding to the CC list for future checkup.
Comment 6 Christian Neumair 2007-09-09 19:28:49 UTC
Owen: While API users can easily determine what line exceeds a certain amount of vertical space (*), I don't see any practicable way to create a new ellipsized layout from that:

While the rest of lines could be thrown away using pango_layout_line_unref (), and maybe the new text can be fetched using pango_layout_get_text () I think we have no way of telling pango to render the last line ellipsized, except by using crude hacks (replace the last few characters with "..." [what about an RTL special-case], or append garbage to the last line and use ellipsization - which would possibly break overlong previous lines).


Do you remember what about a the max_height implementation is particularly challenging when doing ellipsization? The first (unneccessary in some ellipsization modes) approach would be to just create the full layout and then throw away lines [from the beginning, middle or end, depending on the mode] until the max_height is reached, and then just display "..." at a certain position instead of a few characters.


(*) for instance using pango_layout_get_pixel_extents() and iterating over the pango_layout_get_line_readonly() lines until this space is reached, also considering the line spacing
Comment 7 Christian Neumair 2007-09-09 19:35:52 UTC
Bug 147608 also offers some possible solution, I'm not sure whether this includes a height or line count limit.
Comment 8 Behdad Esfahbod 2007-09-09 19:58:27 UTC
Humm, seems like I opened a new bug for it.  See bug 469313.  Keeping this one open for now since it has useful discussion.
Comment 9 GNOME Infrastructure Team 2018-05-22 12:14:36 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/36.