[pango] [pangofc] Be more tolerant on the "fontmap" property setting



commit c5921ca904f3ab25f975e4c719c7334a31d84434
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Apr 8 15:47:00 2009 -0400

    [pangofc] Be more tolerant on the "fontmap" property setting
    
    Bug 578336 â?? ABI breakage from 1.22 to 1.24 in fontmap field of PangoFcFont
    
    Commit 9305b9a9995e84ace3818a90346820ef8c47a3ce introduced a "fontmap"
    property in PangoFcFont and expected all subclasses to set it upon
    construction.  And PangoFcFontSet was changed to not set fcfont->fontmap
    anymore.
    
    Relax this change to make it backward compatible by:
    
      1) Making "fontmap" property a not-construct-only property
    
      2) In PangoFcFontSet, set "fontmap" if not already set
    
    This should make it backward compatible, while allowing new code to set the
    property instead of relying on PangoFcFontSet to do it.
---
 pango/pangofc-font.c    |    2 +-
 pango/pangofc-fontmap.c |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 46ce282..e5df33d 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -109,7 +109,7 @@ pango_fc_font_class_init (PangoFcFontClass *class)
 							"Font Map",
 							"The PangoFc font map this font is associated with (Since: 1.26)",
 							PANGO_TYPE_FC_FONT_MAP,
-							G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+							G_PARAM_READWRITE |
 							G_PARAM_STATIC_STRINGS));
 
   g_type_class_add_private (object_class, sizeof (PangoFcFontPrivate));
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 6ef9001..4db6215 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1565,6 +1565,11 @@ pango_fc_font_map_new_font (PangoFcFontMap    *fcfontmap,
     return NULL;
 
   fcfont->matrix = key.matrix;
+  /* In case the backend didn't set the fontmap */
+  if (!fcfont->fontmap)
+    g_object_set (fcfont,
+		  "fontmap", fcfontmap,
+		  NULL);
 
   /* cache it on fontmap */
   pango_fc_font_map_add (fcfontmap, &key, fcfont);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]