Bug 549729 - Ellipsize set of strings to fit in X space while preserving uniqueness if possible
Ellipsize set of strings to fit in X space while preserving uniqueness if pos...
Status: NEW
Product: pango
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: pango-maint
pango-maint
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-08-28 17:10 UTC by Matthew Paul Thomas (mpt)
Modified: 2008-11-25 17:29 UTC (History)
2 users (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments

Description Matthew Paul Thomas (mpt) 2008-08-28 17:10:36 UTC
There are many cases where a set of strings needs to be ellipsized to fit into graphical interface elements of a consistent size, but it is important that similar strings remain visually distinct.

For example, Web pages in your browser history often have quite similar titles. Sometimes the distinctive part is near the beginning (e.g. "Setting an environment variable for all your apps » as days pass by, by Stuart Langridge"), sometimes it is near the end (e.g. "Rodrigo Moya » Blog Archive » Olympics over"), and sometimes it is near the middle (e.g. "Photos: The ultramobiles of IDF - UMPC-benq image - CNET News"). When these titles are presented in a Web browser's Go/History menu, none of Pango's existing ellipsization options -- PANGO_ELLIPSIZE_UNIQUE_START, PANGO_ELLIPSIZE_MIDDLE, or PANGO_ELLIPSIZE_UNIQUE_END -- will result in unique menu items as often as they could.

Other examples of this problem include:
* Nautilus's icon view <http://blogs.gnome.org/cneumair/2008/08/16/before-after>
* the Name column in Nautilus's list view
* the Subject column in a mail program's message list
* Pidgin's Accounts menu <http://developer.pidgin.im/ticket/6824#comment:3>
* the recent files listed in Totem's "Movie" menu
* a window manager's title bars
* gnome-panel's window list buttons (bug 99604).

For the last example, in bug 99604 comment 7, I devised an algorithm that would produce unique ellipsized names more often than the existing ellipsization options would. The same algorithm could be applied to all these cases, and it is a little tricky to implement, so I suggest it be made available in GTK.

If it was fast enough, the algorithm could even be applied to all GTK menus by default. Most menu items wouldn't change, but very long ones would be ellipsized in a useful way without any programmer effort.
Comment 1 Matthew Paul Thomas (mpt) 2008-08-28 17:12:16 UTC
See also bug 147608.

Thanks to Johan Dahlin for technical advice on this report.

Note You need to log in before you can comment on or make changes to this bug.