Changeset 28876 in webkit


Ignore:
Timestamp:
Dec 19, 2007 3:22:11 PM (16 years ago)
Author:
alp@webkit.org
Message:

2007-12-19 Alp Toker <alp@atoker.com>

Build fix for Pango < 1.18.0 breakage introduced in r28864. Use Fc and
the Pango backend API in these cases.

  • platform/graphics/gtk/FontPlatformDataGtk.cpp: (WebCore::FontPlatformData::FontPlatformData): (WebCore::FontPlatformData::~FontPlatformData):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r28875 r28876  
     12007-12-19  Alp Toker  <alp@atoker.com>
     2
     3        Build fix for Pango < 1.18.0 breakage introduced in r28864. Use Fc and
     4        the Pango backend API in these cases.
     5
     6        * platform/graphics/gtk/FontPlatformDataGtk.cpp:
     7        (WebCore::FontPlatformData::FontPlatformData):
     8        (WebCore::FontPlatformData::~FontPlatformData):
     9
    1102007-12-19  Alice Liu  <alice.liu@apple.com>
    211
  • trunk/WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp

    r28864 r28876  
    2727 */
    2828
     29// Use the Pango backend API for compatibility with older Pango versions.
     30#define PANGO_ENABLE_BACKEND
     31
    2932#include "config.h"
    3033#include "FontPlatformData.h"
     
    3538#include <cairo.h>
    3639#include <assert.h>
     40
     41#include <pango/pango.h>
     42#include <pango/pangocairo.h>
     43
     44// Use cairo-ft if a recent enough Pango version isn't available.
     45#if !PANGO_VERSION_CHECK(1,18,0)
     46#include <cairo-ft.h>
     47#include <pango/pangofc-fontmap.h>
     48#endif
    3749
    3850namespace WebCore {
     
    88100
    89101    // FIXME: should we set some default font?
     102#if PANGO_VERSION_CHECK(1,18,0)
    90103    if (m_font)
    91         m_scaledFont = pango_cairo_font_get_scaled_font(PANGO_CAIRO_FONT(m_font));
     104        m_scaledFont = cairo_scaled_font_reference(pango_cairo_font_get_scaled_font(PANGO_CAIRO_FONT(m_font)));
     105#else
     106    // This compatibility code for older versions of Pango is not well-tested.
     107    if (m_font) {
     108        PangoFcFont* fcfont = PANGO_FC_FONT(m_font);
     109        cairo_font_face_t* face = cairo_ft_font_face_create_for_pattern(fcfont->font_pattern);
     110        double size;
     111        if (FcPatternGetDouble(fcfont->font_pattern, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)
     112            size = 12.0;
     113        cairo_matrix_t fontMatrix;
     114        cairo_matrix_init_scale(&fontMatrix, size, size);
     115        cairo_font_options_t* fontOptions;
     116        if (pango_cairo_context_get_font_options(m_context))
     117            fontOptions = cairo_font_options_copy(pango_cairo_context_get_font_options(m_context));
     118        else
     119            fontOptions = cairo_font_options_create();
     120        cairo_matrix_t ctm;
     121        cairo_matrix_init_identity(&ctm);
     122        m_scaledFont = cairo_scaled_font_create(face, &fontMatrix, &ctm, fontOptions);
     123        cairo_font_options_destroy(fontOptions);
     124        cairo_font_face_destroy(face);
     125    }
     126#endif
    92127
    93128    pango_font_description_free(description);
     
    124159FontPlatformData::~FontPlatformData()
    125160{
     161    if (m_scaledFont)
     162        cairo_scaled_font_destroy(m_scaledFont);
    126163}
    127164
Note: See TracChangeset for help on using the changeset viewer.