From 040ed7df689dee22627dc158d021c3796f6ce31f Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Fri, 17 Apr 2009 12:51:43 -0700 Subject: [PATCH] Bug 478871: Switch to new_font() and default_substitute() functions from Pango API to fix compile issues with newer pango versions. r=behdad sr=roc --- gfx/thebes/src/gfxPangoFonts.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/gfx/thebes/src/gfxPangoFonts.cpp b/gfx/thebes/src/gfxPangoFonts.cpp index 7033f03a82b..9f8a081f9a3 100644 --- a/gfx/thebes/src/gfxPangoFonts.cpp +++ b/gfx/thebes/src/gfxPangoFonts.cpp @@ -1797,23 +1797,17 @@ PrepareSortPattern(FcPattern *aPattern, double aFallbackSize, } static void -gfx_pango_font_map_context_substitute(PangoFcFontMap *fontmap, - PangoContext *context, +gfx_pango_font_map_default_substitute(PangoFcFontMap *fontmap, FcPattern *pattern) { - // owned by the context - PangoFontDescription *desc = pango_context_get_font_description(context); - double size = pango_font_description_get_size(desc) / FLOAT_PANGO_SCALE; - gfxPangoFontGroup *fontGroup = GetFontGroup(context); - PRBool usePrinterFont = fontGroup && fontGroup->GetStyle()->printerFont; - PrepareSortPattern(pattern, size, 1.0, usePrinterFont); + // The context is not available here but most of our rendering is for the + // screen so aIsPrinterFont is set to FALSE. + PrepareSortPattern(pattern, 18.0, 1.0, FALSE); } static PangoFcFont * -gfx_pango_font_map_create_font(PangoFcFontMap *fontmap, - PangoContext *context, - const PangoFontDescription *desc, - FcPattern *pattern) +gfx_pango_font_map_new_font(PangoFcFontMap *fontmap, + FcPattern *pattern) { return PANGO_FC_FONT(g_object_new(GFX_TYPE_PANGO_FC_FONT, "pattern", pattern, NULL)); @@ -1836,10 +1830,14 @@ gfx_pango_font_map_class_init(gfxPangoFontMapClass *klass) // context_key_* virtual functions are only necessary if we want to // dynamically respond to changes in the screen cairo_font_options_t. - // context_substitute and get_font are not likely to be used but - // implemented because the class makes them available. - fcfontmap_class->context_substitute = gfx_pango_font_map_context_substitute; - fcfontmap_class->create_font = gfx_pango_font_map_create_font; + // The APIs for context_substitute/fontset_key_substitute and create_font + // changed between Pango 1.22 and 1.24 so default_substitute and + // new_font are provided instead. + // default_substitute and new_font are not likely to be used but + // implemented because the class makes them available and an + // implementation should provide either create_font or new_font. + fcfontmap_class->default_substitute = gfx_pango_font_map_default_substitute; + fcfontmap_class->new_font = gfx_pango_font_map_new_font; } /**