[gimp] Explicitly ask for a FT font map for the text tool
- From: Tor Lillqvist <tml src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Explicitly ask for a FT font map for the text tool
- Date: Wed, 26 Aug 2009 21:09:50 +0000 (UTC)
commit 347d8db5d11c01b7d779157749aec268e0184916
Author: Tor Lillqvist <tml iki fi>
Date: Thu Aug 27 00:02:23 2009 +0300
Explicitly ask for a FT font map for the text tool
Call pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT)
instead of pango_cairo_font_map_new ().
This avoids a crash on Windows where the default font map is for
CAIRO_FONT_TYPE_WIN32. For the text tool we want freetype and
fontconfig -based fonts.
This requires using a cairo that includes the freetype backend, and a
pango that has been built against such a cairo. That is not yet the
case for the "official" Windows binaries of cairo and pango, but I
will make it so in the future.
app/text/gimpfontlist.c | 4 +++-
app/text/gimptext-compat.c | 4 +++-
app/text/gimptextlayout.c | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/app/text/gimpfontlist.c b/app/text/gimpfontlist.c
index 6ed36c4..df29466 100644
--- a/app/text/gimpfontlist.c
+++ b/app/text/gimpfontlist.c
@@ -123,7 +123,9 @@ 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 ());
+ 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);
g_object_unref (fontmap);
diff --git a/app/text/gimptext-compat.c b/app/text/gimptext-compat.c
index 8f01a55..d464063 100644
--- a/app/text/gimptext-compat.c
+++ b/app/text/gimptext-compat.c
@@ -150,7 +150,9 @@ text_get_extents (const gchar *fontname,
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 ());
+ 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);
g_object_unref (fontmap);
diff --git a/app/text/gimptextlayout.c b/app/text/gimptextlayout.c
index e570c60..9e46b83 100644
--- a/app/text/gimptextlayout.c
+++ b/app/text/gimptextlayout.c
@@ -564,7 +564,9 @@ gimp_text_get_pango_context (GimpText *text,
PangoCairoFontMap *fontmap;
cairo_font_options_t *options;
- fontmap = PANGO_CAIRO_FONT_MAP (pango_cairo_font_map_new ());
+ 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, yres);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]