summaryrefslogtreecommitdiff
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
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.
-rw-r--r--ChangeLog11
-rw-r--r--pango/ellipsize.c9
-rw-r--r--pango/pango-layout.c2
3 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 64834ea5..f3702f5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
+
2006-12-20 Changwoo Ryu <cwryu@debian.org>
* modules/hangul/hangul-defs.h:
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;
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index d84de316..7d78af9a 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2064,7 +2064,7 @@ get_alignment (PangoLayout *layout,
{
PangoAlignment alignment = layout->alignment;
- if (line->layout->auto_dir &&
+ if (alignment != PANGO_ALIGN_CENTER && line->layout->auto_dir &&
direction_simple (line->resolved_dir) ==
-direction_simple (pango_context_get_base_dir (layout->context)))
{