+2008-08-22 Behdad Esfahbod <behdad@gnome.org>
+
+ Bug 549003 – pango_layout_set_height(): layout should not be cleared
+ unless required
+
+ * pango/pango-layout-private.h:
+ * pango/pango-layout.c (pango_layout_init),
+ (pango_layout_set_height), (pango_layout_get_line_count),
+ (pango_layout_clear_lines), (add_line):
+ Don't invalidate layout if the new height does not force
+ ellipsization.
+
2008-08-22 Richard Hult <richard@imendio.com>
* pango/pangoatsui.c: (_pango_atsui_font_set_font_map): Fix build,
layout->log_attrs = NULL;
layout->lines = NULL;
+ layout->line_count = 0;
layout->tab_width = -1;
layout->unknown_glyphs_count = -1;
{
layout->height = height;
- if (layout->ellipsize != PANGO_ELLIPSIZE_NONE)
+ /* Do not invalidate if the number of lines requested is
+ * larger than the total number of lines in layout.
+ * Bug 549003
+ */
+ if (layout->ellipsize != PANGO_ELLIPSIZE_NONE &&
+ !(layout->lines && layout->is_ellipsized == FALSE && layout->line_count <= -height))
pango_layout_clear_lines (layout);
}
}
g_return_val_if_fail (layout != NULL, 0);
pango_layout_check_lines (layout);
- return g_slist_length (layout->lines);
+ return layout->line_count;
}
/**
g_slist_free (layout->lines);
layout->lines = NULL;
+ layout->line_count = 0;
/* This could be handled separately, since we don't need to
* recompute log_attrs on a width change, but this is easiest
/* we prepend, then reverse the list later */
layout->lines = g_slist_prepend (layout->lines, line);
+ layout->line_count++;
if (layout->height >= 0)
{