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.
This commit is contained in:
Sven Neumann 2010-09-07 00:50:13 +02:00
parent 4264afbb0e
commit d96b491050
6 changed files with 36 additions and 29 deletions

View file

@ -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/.

View file

@ -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,

View file

@ -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));

View file

@ -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);

View file

@ -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);

View file

@ -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