clutter-text: prevent reset of user set font descriptions on dpi changes

When setting the font using clutter_text_set_font_description(), the
font settings on a ClutterText actor can be reset when there is a dpi
changes signaled by the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=702016
This commit is contained in:
Lionel Landwerlin 2013-06-11 14:01:30 +01:00
parent 3bcee2b122
commit fa933b5ec5

View File

@ -568,10 +568,13 @@ clutter_text_dirty_cache (ClutterText *text)
*/ */
static inline void static inline void
clutter_text_set_font_description_internal (ClutterText *self, clutter_text_set_font_description_internal (ClutterText *self,
PangoFontDescription *desc) PangoFontDescription *desc,
gboolean is_default_font)
{ {
ClutterTextPrivate *priv = self->priv; ClutterTextPrivate *priv = self->priv;
priv->is_default_font = is_default_font;
if (priv->font_desc == desc || if (priv->font_desc == desc ||
pango_font_description_equal (priv->font_desc, desc)) pango_font_description_equal (priv->font_desc, desc))
return; return;
@ -619,7 +622,7 @@ clutter_text_settings_changed_cb (ClutterText *text)
font_name); font_name);
font_desc = pango_font_description_from_string (font_name); font_desc = pango_font_description_from_string (font_name);
clutter_text_set_font_description_internal (text, font_desc); clutter_text_set_font_description_internal (text, font_desc, TRUE);
pango_font_description_free (font_desc); pango_font_description_free (font_desc);
g_free (font_name); g_free (font_name);
@ -4945,7 +4948,8 @@ clutter_text_set_font_description (ClutterText *self,
{ {
g_return_if_fail (CLUTTER_IS_TEXT (self)); g_return_if_fail (CLUTTER_IS_TEXT (self));
clutter_text_set_font_description_internal (self, font_desc); clutter_text_set_font_description_internal (self, font_desc,
font_desc == NULL);
} }
/** /**
@ -5052,8 +5056,7 @@ clutter_text_set_font_name (ClutterText *self,
} }
/* this will set the font_name field as well */ /* this will set the font_name field as well */
clutter_text_set_font_description_internal (self, desc); clutter_text_set_font_description_internal (self, desc, is_default_font);
priv->is_default_font = is_default_font;
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]); g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]);