[gimp] Update use of Pango API and bump required version to 1.22.0



commit d96b491050ee3835173d043efa694cf312da008c
Author: Sven Neumann <sven gimp org>
Date:   Tue Sep 7 00:50:13 2010 +0200

    Update use of Pango API and bump required version to 1.22.0
    
    Uodate Pango required version and stop using the deprecated
    pango_cairo_font_map_create_context(). Compile with
    PANGO_DISABLED_DEPRECATED for pango < 1.30.

 INSTALL                    |    2 +-
 app/sanity.c               |    4 ++--
 app/text/gimpfontlist.c    |   17 ++++++++++-------
 app/text/gimptext-compat.c |   15 +++++++++------
 app/text/gimptextlayout.c  |   13 +++++++------
 configure.ac               |   14 +++++++-------
 6 files changed, 36 insertions(+), 29 deletions(-)
---
diff --git a/INSTALL b/INSTALL
index df0294e..8a14946 100644
--- a/INSTALL
+++ b/INSTALL
@@ -45,7 +45,7 @@ header files installed.
 
   4. You need to have installed GTK+ version 2.20.0 or newer.
      GIMP also need a recent versions of GLib (>= 2.24.0) and
-     Pango (>= 1.20.1). Sources for these can be grabbed from
+     Pango (>= 1.22.0). Sources for these can be grabbed from
      ftp://ftp.gtk.org/.
 
   5. We use cairo, which is hosted at http://www.cairographics.org/.
diff --git a/app/sanity.c b/app/sanity.c
index b57618f..cbd6ac5 100644
--- a/app/sanity.c
+++ b/app/sanity.c
@@ -188,8 +188,8 @@ static gchar *
 sanity_check_pango (void)
 {
 #define PANGO_REQUIRED_MAJOR 1
-#define PANGO_REQUIRED_MINOR 20
-#define PANGO_REQUIRED_MICRO 1
+#define PANGO_REQUIRED_MINOR 22
+#define PANGO_REQUIRED_MICRO 0
 
   const gchar *mismatch = pango_version_check (PANGO_REQUIRED_MAJOR,
                                                PANGO_REQUIRED_MINOR,
diff --git a/app/text/gimpfontlist.c b/app/text/gimpfontlist.c
index df29466..3459331 100644
--- a/app/text/gimpfontlist.c
+++ b/app/text/gimpfontlist.c
@@ -97,8 +97,8 @@ gimp_font_list_new (gdouble xresolution,
 void
 gimp_font_list_restore (GimpFontList *list)
 {
-  PangoCairoFontMap *fontmap;
-  PangoContext      *context;
+  PangoFontMap *fontmap;
+  PangoContext *context;
 
   g_return_if_fail (GIMP_IS_FONT_LIST (list));
 
@@ -123,11 +123,14 @@ gimp_font_list_restore (GimpFontList *list)
         font_desc_to_string = &pango_font_description_to_string;
     }
 
-  fontmap = PANGO_CAIRO_FONT_MAP (pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT));
-  if (fontmap == NULL)
-    g_error ("You are using a Pango that has been built against a cairo that lacks the Freetype font backend");
-  pango_cairo_font_map_set_resolution (fontmap, list->yresolution);
-  context = pango_cairo_font_map_create_context (fontmap);
+  fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
+  if (! fontmap)
+    g_error ("You are using a Pango that has been built against a cairo "
+             "that lacks the Freetype font backend");
+
+  pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (fontmap),
+                                       list->yresolution);
+  context = pango_font_map_create_context (fontmap);
   g_object_unref (fontmap);
 
   gimp_container_freeze (GIMP_CONTAINER (list));
diff --git a/app/text/gimptext-compat.c b/app/text/gimptext-compat.c
index d464063..1faee01 100644
--- a/app/text/gimptext-compat.c
+++ b/app/text/gimptext-compat.c
@@ -144,17 +144,20 @@ text_get_extents (const gchar *fontname,
   PangoFontDescription *font_desc;
   PangoContext         *context;
   PangoLayout          *layout;
-  PangoCairoFontMap    *fontmap;
+  PangoFontMap         *fontmap;
   PangoRectangle        rect;
 
   g_return_val_if_fail (fontname != NULL, FALSE);
   g_return_val_if_fail (text != NULL, FALSE);
 
-  fontmap = PANGO_CAIRO_FONT_MAP (pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT));
-  if (fontmap == NULL)
-    g_error ("You are using a Pango that has been built against a cairo that lacks the Freetype font backend");
-  pango_cairo_font_map_set_resolution (fontmap, 72.0); /* FIXME: resolution */
-  context = pango_cairo_font_map_create_context (fontmap);
+  fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
+  if (! fontmap)
+    g_error ("You are using a Pango that has been built against a cairo "
+             "that lacks the Freetype font backend");
+
+  pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (fontmap),
+                                       72.0); /* FIXME: resolution */
+  context = pango_font_map_create_context (fontmap);
   g_object_unref (fontmap);
 
   layout = pango_layout_new (context);
diff --git a/app/text/gimptextlayout.c b/app/text/gimptextlayout.c
index f107098..7ceab87 100644
--- a/app/text/gimptextlayout.c
+++ b/app/text/gimptextlayout.c
@@ -610,16 +610,17 @@ gimp_text_get_pango_context (GimpText *text,
                              gdouble   yres)
 {
   PangoContext         *context;
-  PangoCairoFontMap    *fontmap;
+  PangoFontMap         *fontmap;
   cairo_font_options_t *options;
 
-  fontmap = PANGO_CAIRO_FONT_MAP (pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT));
-  if (fontmap == NULL)
-    g_error ("You are using a Pango that has been built against a cairo that lacks the Freetype font backend");
+  fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
+  if (! fontmap)
+    g_error ("You are using a Pango that has been built against a cairo "
+             "that lacks the Freetype font backend");
 
-  pango_cairo_font_map_set_resolution (fontmap, yres);
+  pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (fontmap), yres);
 
-  context = pango_cairo_font_map_create_context (fontmap);
+  context = pango_font_map_create_context (fontmap);
   g_object_unref (fontmap);
 
   options = gimp_text_get_font_options (text);
diff --git a/configure.ac b/configure.ac
index 30cf095..830d40c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,7 +47,7 @@ m4_define([gtk_required_version], [2.20.0])
 m4_define([gdk_pixbuf_required_version], [gtk_required_version])
 m4_define([cairo_required_version], [1.8.0])
 m4_define([cairo_pdf_required_version], [1.8.0])
-m4_define([pangocairo_required_version], [1.20.1])
+m4_define([pangocairo_required_version], [1.22.0])
 m4_define([fontconfig_required_version], [2.2.0])
 m4_define([gtkdoc_required_version], [1.0])
 m4_define([webkit_required_version], [1.1.0])
@@ -520,13 +520,13 @@ CFLAGS="$PANGOCAIRO_CFLAGS $CFLAGS"
 
 PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= fontconfig_required_version)
 
-AC_MSG_CHECKING([if Pango is version 1.22.0 or newer])
-if $PKG_CONFIG --atleast-version=1.22.0 pango; then
-  have_pango_1_22=yes
+AC_MSG_CHECKING([if Pango is version 1.30.0 or newer])
+if $PKG_CONFIG --atleast-version=1.30.0 pango; then
+  have_pango_1_30=yes
 else
-  have_pango_1_22=no
+  have_pango_1_30=no
 fi
-AC_MSG_RESULT($have_pango_1_22)
+AC_MSG_RESULT($have_pango_1_30)
 
 CFLAGS="$PANGOCAIRO_CFLAGS $CFLAGS"
 
@@ -1917,7 +1917,7 @@ if test "x$have_gtk_2_22" != "xyes"; then
   CPPFLAGS="${CPPFLAGS} -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
 fi
 
-if test "x$have_pango_1_22" != "xyes"; then
+if test "x$have_pango_1_30" != "xyes"; then
   CPPFLAGS="${CPPFLAGS} -DPANGO_DISABLE_DEPRECATED"
 fi
 



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