From 4f4e1748e219f431550a0a804c9d3fc4267e97ef Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 19 Dec 2006 21:39:26 +0000 Subject: =?UTF-8?q?Bug=20326099=20=E2=80=93=20Setting=20width,=20indentati?= =?UTF-8?q?on=20and=20ellipsizing=20doesn't=20work=20as?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2006-12-19 Behdad Esfahbod Bug 326099 – Setting width, indentation and ellipsizing doesn't work as I would expect * pango/ellipsize.c (_pango_layout_line_ellipsize): Account for indentation when deciding what width to ellipsize for. --- ChangeLog | 8 ++++++++ pango/ellipsize.c | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03da8aea..bdc5363d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-12-19 Behdad Esfahbod + + Bug 326099 – Setting width, indentation and ellipsizing doesn't work + as I would expect + + * pango/ellipsize.c (_pango_layout_line_ellipsize): Account for + indentation when deciding what width to ellipsize for. + 2006-12-13 Behdad Esfahbod Bug 319808 – Patch to let pango support artifical italic, bold and diff --git a/pango/ellipsize.c b/pango/ellipsize.c index a8ac04c9..22f6e4b4 100644 --- a/pango/ellipsize.c +++ b/pango/ellipsize.c @@ -723,6 +723,7 @@ _pango_layout_line_ellipsize (PangoLayoutLine *line, PangoAttrList *attrs) { EllipsizeState state; + int goal_width; if (line->layout->ellipsize == PANGO_ELLIPSIZE_NONE || line->layout->width < 0) @@ -730,12 +731,16 @@ _pango_layout_line_ellipsize (PangoLayoutLine *line, init_state (&state, line, attrs); - if (state.total_width <= state.layout->width) + goal_width = state.layout->width; + if (state.layout->indent > 0 && state.layout->alignment != PANGO_ALIGN_CENTER) + goal_width -= state.layout->indent; + + if (state.total_width <= goal_width) goto out; find_initial_span (&state); - while (current_width (&state) > state.layout->width) + while (current_width (&state) > goal_width) { if (!remove_one_span (&state)) break; -- cgit v1.2.1