pango r2717 - in trunk: . pango
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: pango r2717 - in trunk: . pango
- Date: Thu, 11 Sep 2008 20:59:59 +0000 (UTC)
Author: behdad
Date: Thu Sep 11 20:59:59 2008
New Revision: 2717
URL: http://svn.gnome.org/viewvc/pango?rev=2717&view=rev
Log:
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!
Modified:
trunk/ChangeLog
trunk/pango/pango-layout.c
Modified: trunk/pango/pango-layout.c
==============================================================================
--- trunk/pango/pango-layout.c (original)
+++ trunk/pango/pango-layout.c Thu Sep 11 20:59:59 2008
@@ -617,6 +617,10 @@
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 @@
{
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 @@
{
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 @@
{
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_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 @@
{
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);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]