summaryrefslogtreecommitdiff
path: root/pango/ellipsize.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-12-19 21:37:39 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-12-19 21:37:39 +0000
commitb6ff5b076ead703a36fa5aed17e5b1e2946330e4 (patch)
tree82fb9d3f6b545af07ce3f2dd8f73fa4788f0494a /pango/ellipsize.c
parentf9cae2d7edabf388e67b40962a9b1057d4e42613 (diff)
downloadpango-b6ff5b076ead703a36fa5aed17e5b1e2946330e4.tar.gz
Bug 326099 – Setting width, indentation and ellipsizing doesn't work as
2006-12-19 Behdad Esfahbod <behdad@gnome.org> 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. * pango/pango-layout.c (get_alignment): Don't bother about conditioning on the line direction for center alignment.
Diffstat (limited to 'pango/ellipsize.c')
-rw-r--r--pango/ellipsize.c9
1 files changed, 7 insertions, 2 deletions
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;