summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-09-11 20:59:59 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-09-11 20:59:59 +0000
commit43be640afa7428c12da8d82d43207997ca46178f (patch)
tree5c835cde87c307b658ff6c05025b2fb32ad502e0 /pango
parent465f5a09a48096857809d6c210d8ea26ae1d92d8 (diff)
downloadpango-43be640afa7428c12da8d82d43207997ca46178f.tar.gz
Bug 551865 – Can't change justification of a PangoLayout after first
2008-09-11 Behdad Esfahbod <behdad@gnome.org> Bug 551865 – Can't change justification of a PangoLayout after first draw * pango/pango-layout.c (pango_layout_set_attributes), (pango_layout_set_font_description), (pango_layout_set_justify), (pango_layout_set_alignment), (pango_layout_set_tabs): Invalidate layout after property change. Oops! svn path=/trunk/; revision=2717
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-layout.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index e5b6e269..0d2f6a7b 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -617,6 +617,10 @@ pango_layout_set_attributes (PangoLayout *layout,
old_attrs = layout->attrs;
+ /* We always clear lines such that this function can be called
+ * whenever attrs changes.
+ */
+
layout->attrs = attrs;
if (layout->attrs)
pango_attr_list_ref (layout->attrs);
@@ -659,15 +663,13 @@ pango_layout_set_font_description (PangoLayout *layout,
{
g_return_if_fail (layout != NULL);
- if (desc != layout->font_desc)
+ if (desc != layout->font_desc &&
+ (!desc || !layout->font_desc || !pango_font_description_equal(desc, layout->font_desc)))
{
if (layout->font_desc)
pango_font_description_free (layout->font_desc);
- if (desc)
- layout->font_desc = pango_font_description_copy (desc);
- else
- layout->font_desc = NULL;
+ layout->font_desc = desc ? pango_font_description_copy (desc) : NULL;
pango_layout_clear_lines (layout);
layout->tab_width = -1;
@@ -715,7 +717,13 @@ pango_layout_set_justify (PangoLayout *layout,
{
g_return_if_fail (layout != NULL);
- layout->justify = justify;
+ if (justify != layout->justify)
+ {
+ layout->justify = justify;
+
+ if (layout->is_ellipsized || layout->is_wrapped)
+ pango_layout_clear_lines (layout);
+ }
}
/**
@@ -809,7 +817,11 @@ pango_layout_set_alignment (PangoLayout *layout,
{
g_return_if_fail (layout != NULL);
- layout->alignment = alignment;
+ if (alignment != layout->alignment)
+ {
+ layout->alignment = alignment;
+ pango_layout_clear_lines (layout);
+ }
}
/**
@@ -832,7 +844,7 @@ pango_layout_get_alignment (PangoLayout *layout)
/**
* pango_layout_set_tabs:
* @layout: a #PangoLayout
- * @tabs: a #PangoTabArray
+ * @tabs: a #PangoTabArray, or %NULL
*
* Sets the tabs to use for @layout, overriding the default tabs
* (by default, tabs are every 8 spaces). If @tabs is %NULL, the default
@@ -845,10 +857,16 @@ pango_layout_set_tabs (PangoLayout *layout,
{
g_return_if_fail (PANGO_IS_LAYOUT (layout));
- if (layout->tabs)
- pango_tab_array_free (layout->tabs);
- layout->tabs = tabs ? pango_tab_array_copy (tabs) : NULL;
+ if (tabs != layout->tabs)
+ {
+ if (layout->tabs)
+ pango_tab_array_free (layout->tabs);
+
+ layout->tabs = tabs ? pango_tab_array_copy (tabs) : NULL;
+
+ pango_layout_clear_lines (layout);
+ }
}
/**