[GTK] Remove the Pango backend
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2012 09:05:54 +0000 (09:05 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2012 09:05:54 +0000 (09:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104569

Reviewed by Daniel Bates.

.:

Always look for Freetype and Harfbuzz. We still depend on Pango for a few
things, so we cannot yet eliminate our dependency on Pango.

* configure.ac: Always look for FreeType/Harfbuzz.

Source/WebCore:

Remove the Pango backend entirely. The EFL build has no support for it and it's
not really maintained enough for the GTK+ port, now that HarfbuzzNG shapes complex
text when Freetype is the active text rendering backend.

No new tests. This does not change behavior.

* GNUmakefile.am: Remove Pango backend options and move Freetype options to the common list.
* GNUmakefile.list.am: Ditto.
* platform/graphics/FontPlatformData.h:
* platform/graphics/pango/FontCachePango.cpp: Removed.
* platform/graphics/pango/FontCustomPlatformDataPango.cpp: Removed.
* platform/graphics/pango/FontPango.cpp: Removed.
* platform/graphics/pango/FontPlatformData.h: Removed.
* platform/graphics/pango/FontPlatformDataPango.cpp: Removed.
* platform/graphics/pango/GlyphPageTreeNodePango.cpp: Removed.
* platform/graphics/pango/PangoUtilities.cpp: Removed.
* platform/graphics/pango/PangoUtilities.h: Removed.
* platform/graphics/pango/SimpleFontDataPango.cpp: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137263 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/pango/FontCachePango.cpp [deleted file]
Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp [deleted file]
Source/WebCore/platform/graphics/pango/FontPango.cpp [deleted file]
Source/WebCore/platform/graphics/pango/FontPlatformData.h [deleted file]
Source/WebCore/platform/graphics/pango/FontPlatformDataPango.cpp [deleted file]
Source/WebCore/platform/graphics/pango/GlyphPageTreeNodePango.cpp [deleted file]
Source/WebCore/platform/graphics/pango/PangoUtilities.cpp [deleted file]
Source/WebCore/platform/graphics/pango/PangoUtilities.h [deleted file]
Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp [deleted file]
configure.ac

index 0c14f03..5e374ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-12-10  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Remove the Pango backend
+        https://bugs.webkit.org/show_bug.cgi?id=104569
+
+        Reviewed by Daniel Bates.
+
+        Always look for Freetype and Harfbuzz. We still depend on Pango for a few
+        things, so we cannot yet eliminate our dependency on Pango.
+
+        * configure.ac: Always look for FreeType/Harfbuzz.
+
 2012-12-10  Laszlo Gombos  <l.gombos@samsung.com>
 
         [EFL] Change the minimum required EFL version to 1.6
index 28a9ea1..3445df8 100644 (file)
@@ -1,3 +1,29 @@
+2012-12-10  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Remove the Pango backend
+        https://bugs.webkit.org/show_bug.cgi?id=104569
+
+        Reviewed by Daniel Bates.
+
+        Remove the Pango backend entirely. The EFL build has no support for it and it's
+        not really maintained enough for the GTK+ port, now that HarfbuzzNG shapes complex
+        text when Freetype is the active text rendering backend.
+
+        No new tests. This does not change behavior.
+
+        * GNUmakefile.am: Remove Pango backend options and move Freetype options to the common list.
+        * GNUmakefile.list.am: Ditto.
+        * platform/graphics/FontPlatformData.h:
+        * platform/graphics/pango/FontCachePango.cpp: Removed.
+        * platform/graphics/pango/FontCustomPlatformDataPango.cpp: Removed.
+        * platform/graphics/pango/FontPango.cpp: Removed.
+        * platform/graphics/pango/FontPlatformData.h: Removed.
+        * platform/graphics/pango/FontPlatformDataPango.cpp: Removed.
+        * platform/graphics/pango/GlyphPageTreeNodePango.cpp: Removed.
+        * platform/graphics/pango/PangoUtilities.cpp: Removed.
+        * platform/graphics/pango/PangoUtilities.h: Removed.
+        * platform/graphics/pango/SimpleFontDataPango.cpp: Removed.
+
 2012-12-11  Andrey Adaikin  <aandrey@chromium.org>
 
         Web Inspector: [WebGL] prevent GC from collecting WebGLObject instances currently bound to the context state
index 63dbd0d..cd6d0f3 100644 (file)
@@ -5,6 +5,8 @@ WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.in
 WEBCORE_CSS_VALUE_KEYWORDS := $(WebCore)/css/CSSValueKeywords.in
 
 webcore_cppflags += \
+       -DWTF_USE_FREETYPE=1 \
+       -DWTF_USE_HARFBUZZ_NG=1 \
        -I$(srcdir)/Source/ThirdParty/ANGLE/src \
        -I$(srcdir)/Source/ThirdParty/ANGLE/include \
        -I$(srcdir)/Source/ThirdParty/ANGLE/include/GLSLANG \
@@ -58,7 +60,10 @@ webcore_cppflags += \
        -I$(srcdir)/Source/WebCore/platform/graphics/cpu/arm/filters/ \
        -I$(srcdir)/Source/WebCore/platform/graphics/filters \
        -I$(srcdir)/Source/WebCore/platform/graphics/filters/texmap \
+       -I$(srcdir)/Source/WebCore/platform/graphics/freetype \
        -I$(srcdir)/Source/WebCore/platform/graphics/gpu \
+       -I$(srcdir)/Source/WebCore/platform/graphics/harfbuzz \
+       -I$(srcdir)/Source/WebCore/platform/graphics/harfbuzz/ng \
        -I$(srcdir)/Source/WebCore/platform/graphics/opengl \
        -I$(srcdir)/Source/WebCore/platform/graphics/opentype \
        -I$(srcdir)/Source/WebCore/platform/graphics/transforms \
@@ -106,6 +111,8 @@ webcore_cppflags += \
 
 webcoregtk_cppflags += \
        -DWEBKITGTK_API_VERSION_STRING=\"@WEBKITGTK_API_VERSION@\" \
+       -DWTF_USE_FREETYPE=1 \
+       -DWTF_USE_HARFBUZZ_NG=1 \
        -DWTF_USE_SOUP=1 \
        -I$(srcdir)/Source/WebCore/accessibility/atk \
        -I$(srcdir)/Source/WebCore/loader/gtk \
@@ -114,7 +121,10 @@ webcoregtk_cppflags += \
        -I$(srcdir)/Source/WebCore/platform/audio/gstreamer \
        -I$(srcdir)/Source/WebCore/platform/geoclue \
        -I$(srcdir)/Source/WebCore/platform/graphics/cairo \
+       -I$(srcdir)/Source/WebCore/platform/graphics/freetype \
        -I$(srcdir)/Source/WebCore/platform/graphics/glx \
+       -I$(srcdir)/Source/WebCore/platform/graphics/harfbuzz \
+       -I$(srcdir)/Source/WebCore/platform/graphics/harfbuzz/ng \
        -I$(srcdir)/Source/WebCore/platform/graphics/egl \
        -I$(srcdir)/Source/WebCore/platform/graphics/gstreamer \
        -I$(srcdir)/Source/WebCore/platform/graphics/gtk \
@@ -123,27 +133,6 @@ webcoregtk_cppflags += \
        -I$(srcdir)/Source/WebCore/platform/text/enchant
 
 # ---
-# FreeType font backend
-# ---
-if USE_FREETYPE
-webcoregtk_cppflags += \
-       -DWTF_USE_FREETYPE=1 \
-       -DWTF_USE_HARFBUZZ_NG=1 \
-       -I$(srcdir)/Source/WebCore/platform/graphics/freetype \
-       -I$(srcdir)/Source/WebCore/platform/graphics/harfbuzz \
-       -I$(srcdir)/Source/WebCore/platform/graphics/harfbuzz/ng
-endif # END USE_FREETYPE
-
-# ---
-# Pango font backend
-# ---
-if USE_PANGO
-webcoregtk_cppflags += \
-       -DWTF_USE_PANGO=1 \
-       -I$(srcdir)/Source/WebCore/platform/graphics/pango
-endif # END USE_PANGO
-
-# ---
 # Windows plugin support
 # ---
 if TARGET_WIN32
index 1009a27..803a989 100644 (file)
@@ -4159,6 +4159,18 @@ webcore_sources += \
        Source/WebCore/page/WindowFocusAllowedIndicator.h \
        Source/WebCore/page/WorkerNavigator.cpp \
        Source/WebCore/page/WorkerNavigator.h \
+       Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp \
+       Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp \
+       Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp \
+       Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp \
+       Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp \
+       Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp \
+       Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.h \
+       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.cpp \
+       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h \
+       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp \
+       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp \
+       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h \
        Source/WebCore/plugins/npapi.h \
        Source/WebCore/plugins/npruntime.h \
        Source/WebCore/plugins/nptypes.h \
@@ -5972,6 +5984,8 @@ webcoregtk_sources += \
        Source/WebCore/platform/geoclue/GeolocationProviderGeoclueClient.h \
        Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp \
        Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h \
+       Source/WebCore/platform/graphics/freetype/FontPlatformData.h \
+       Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp \
        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp \
        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h \
        Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp \
@@ -6152,44 +6166,6 @@ webcore_sources += \
        Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp
 endif
 
-# ---
-# FreeType font backend
-# ---
-if USE_FREETYPE
-webcore_sources += \
-       Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp \
-       Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp \
-       Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp \
-       Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp \
-       Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp \
-       Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp \
-       Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.h \
-       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.cpp \
-       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h \
-       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp \
-       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp \
-       Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h
-webcoregtk_sources += \
-       Source/WebCore/platform/graphics/freetype/FontPlatformData.h \
-       Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
-
-endif # END USE_FREETYPE
-
-# ---
-# Pango font backend
-# ---
-if USE_PANGO
-webcore_sources += \
-       Source/WebCore/platform/graphics/pango/FontCachePango.cpp \
-       Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp \
-       Source/WebCore/platform/graphics/pango/FontPlatformDataPango.cpp \
-       Source/WebCore/platform/graphics/pango/FontPlatformData.h \
-       Source/WebCore/platform/graphics/pango/GlyphPageTreeNodePango.cpp \
-       Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
-webcoregtk_sources += \
-       Source/WebCore/platform/graphics/pango/FontPango.cpp
-endif # END USE_PANGO
-
 if USE_GSTREAMER
 webcoregtk_sources += \
        Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp \
index f5057d6..8224492 100644 (file)
 #include "wince/FontPlatformData.h"
 #elif PLATFORM(WX)
 #include "wx/FontPlatformData.h"
-#elif (PLATFORM(EFL) || PLATFORM(GTK)) && USE(FREETYPE)
+#elif PLATFORM(EFL) || PLATFORM(GTK)
 #include "freetype/FontPlatformData.h"
-#elif (PLATFORM(EFL) || PLATFORM(GTK)) && USE(PANGO)
-#include "pango/FontPlatformData.h"
 #else
 
 #ifndef FontPlatformData_h
diff --git a/Source/WebCore/platform/graphics/pango/FontCachePango.cpp b/Source/WebCore/platform/graphics/pango/FontCachePango.cpp
deleted file mode 100644 (file)
index 06d63c5..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2008 Alp Toker <alp@atoker.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "FontCache.h"
-
-#include "Font.h"
-#include "OwnPtrCairo.h"
-#include "SimpleFontData.h"
-#include <wtf/Assertions.h>
-#include <wtf/text/CString.h>
-
-namespace WebCore {
-
-void FontCache::platformInit()
-{
-    if (!FontPlatformData::init())
-        ASSERT_NOT_REACHED();
-}
-
-PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
-{
-    return 0;
-}
-
-PassRefPtr<SimpleFontData> FontCache::getSimilarFontPlatformData(const Font& font)
-{
-    return 0;
-}
-
-PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
-{
-    // FIXME: Would be even better to somehow get the user's default font here.
-    // For now we'll pick the default that the user would get without changing any prefs.
-    static AtomicString timesStr("Times New Roman");
-    return getCachedFontData(fontDescription, timesStr, false, shouldRetain);
-}
-
-void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
-{
-}
-
-FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
-{
-    return new FontPlatformData(fontDescription, family);
-}
-
-}
diff --git a/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp b/Source/WebCore/platform/graphics/pango/FontCustomPlatformDataPango.cpp
deleted file mode 100644 (file)
index f9d36d3..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2008 Alp Toker <alp@atoker.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "FontCustomPlatformData.h"
-
-#include "SharedBuffer.h"
-#include "FontPlatformData.h"
-
-namespace WebCore {
-
-FontCustomPlatformData::~FontCustomPlatformData()
-{
-}
-
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode)
-{
-    return FontPlatformData(m_fontFace, size, bold, italic);
-}
-
-static void releaseData(void* data)
-{
-    static_cast<SharedBuffer*>(data)->deref();
-}
-
-FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
-{
-    // FIXME: we need support in pango to read fonts from memory to implement this.y
-    return 0;
-}
-
-bool FontCustomPlatformData::supportsFormat(const String& /* format */)
-{
-    return false;
-}
-
-}
diff --git a/Source/WebCore/platform/graphics/pango/FontPango.cpp b/Source/WebCore/platform/graphics/pango/FontPango.cpp
deleted file mode 100644 (file)
index b91bfc9..0000000
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Copyright (c) 2007 Hiroyuki Ikezoe
- * Copyright (c) 2007 Kouhei Sutou
- * Copyright (C) 2007 Alp Toker <alp@atoker.com>
- * Copyright (C) 2008 Xan Lopez <xan@gnome.org>
- * Copyright (C) 2008 Nuanti Ltd.
- * Copyright (C) 2011 ProFUSION embedded systems
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Font.h"
-
-#include "CairoUtilities.h"
-#include <wtf/gobject/GOwnPtr.h>
-#include "GraphicsContext.h"
-#include "NotImplemented.h"
-#include "PlatformContextCairo.h"
-#include "ShadowBlur.h"
-#include "SimpleFontData.h"
-#include "TextRun.h"
-#include <cairo.h>
-#include <pango/pango.h>
-#include <pango/pangocairo.h>
-
-#if PLATFORM(GTK)
-#include <gdk/gdk.h>
-#else
-#include "PangoUtilities.h"
-#endif
-
-#if USE(FREETYPE)
-#include <pango/pangofc-fontmap.h>
-#endif
-
-namespace WebCore {
-
-#ifdef GTK_API_VERSION_2
-typedef GdkRegion* PangoRegionType;
-
-void destroyPangoRegion(PangoRegionType region)
-{
-    gdk_region_destroy(region);
-}
-
-IntRect getPangoRegionExtents(PangoRegionType region)
-{
-    GdkRectangle rectangle;
-    gdk_region_get_clipbox(region, &rectangle);
-    return IntRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
-}
-#else
-typedef cairo_region_t* PangoRegionType;
-
-void destroyPangoRegion(PangoRegionType region)
-{
-    cairo_region_destroy(region);
-}
-
-IntRect getPangoRegionExtents(PangoRegionType region)
-{
-    cairo_rectangle_int_t rectangle;
-    cairo_region_get_extents(region, &rectangle);
-    return IntRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
-}
-#endif
-
-#define IS_HIGH_SURROGATE(u)  ((UChar)(u) >= (UChar)0xd800 && (UChar)(u) <= (UChar)0xdbff)
-#define IS_LOW_SURROGATE(u)  ((UChar)(u) >= (UChar)0xdc00 && (UChar)(u) <= (UChar)0xdfff)
-
-static gchar* utf16ToUtf8(const UChar* aText, gint aLength, gint &length)
-{
-    gboolean needCopy = FALSE;
-
-    for (int i = 0; i < aLength; i++) {
-        if (!aText[i] || IS_LOW_SURROGATE(aText[i])) {
-            needCopy = TRUE;
-            break;
-        } 
-
-        if (IS_HIGH_SURROGATE(aText[i])) {
-            if (i < aLength - 1 && IS_LOW_SURROGATE(aText[i+1]))
-                i++;
-            else {
-                needCopy = TRUE;
-                break;
-            }
-        }
-    }
-
-    GOwnPtr<UChar> copiedString;
-    if (needCopy) {
-        /* Pango doesn't correctly handle nuls.  We convert them to 0xff. */
-        /* Also "validate" UTF-16 text to make sure conversion doesn't fail. */
-
-        copiedString.set(static_cast<UChar*>(g_memdup(aText, aLength * sizeof(aText[0]))));
-        UChar* p = copiedString.get();
-
-        /* don't need to reset i */
-        for (int i = 0; i < aLength; i++) {
-            if (!p[i] || IS_LOW_SURROGATE(p[i]))
-                p[i] = 0xFFFD;
-            else if (IS_HIGH_SURROGATE(p[i])) {
-                if (i < aLength - 1 && IS_LOW_SURROGATE(aText[i+1]))
-                    i++;
-                else
-                    p[i] = 0xFFFD;
-            }
-        }
-
-        aText = p;
-    }
-
-    gchar* utf8Text;
-    glong itemsWritten;
-    utf8Text = g_utf16_to_utf8(reinterpret_cast<const gunichar2*>(aText), aLength, 0, &itemsWritten, 0);
-    length = itemsWritten;
-
-    return utf8Text;
-}
-
-static gchar* convertUniCharToUTF8(const UChar* characters, gint length, int from, int to)
-{
-    gint newLength = 0;
-    GOwnPtr<gchar> utf8Text(utf16ToUtf8(characters, length, newLength));
-    if (!utf8Text)
-        return 0;
-
-    gchar* pos = utf8Text.get();
-    if (from > 0) {
-        // discard the first 'from' characters
-        // FIXME: we should do this before the conversion probably
-        pos = g_utf8_offset_to_pointer(utf8Text.get(), from);
-    }
-
-    gint len = strlen(pos);
-    GString* ret = g_string_new_len(NULL, len);
-
-    // replace line break by space
-    while (len > 0) {
-        gint index, start;
-        pango_find_paragraph_boundary(pos, len, &index, &start);
-        g_string_append_len(ret, pos, index);
-        if (index == start)
-            break;
-        g_string_append_c(ret, ' ');
-        pos += start;
-        len -= start;
-    }
-    return g_string_free(ret, FALSE);
-}
-
-static void setPangoAttributes(const Font* font, const TextRun& run, PangoLayout* layout)
-{
-#if USE(FREETYPE)
-    if (font->primaryFont()->platformData().m_pattern) {
-        PangoFontDescription* desc = pango_fc_font_description_from_pattern(font->primaryFont()->platformData().m_pattern.get(), FALSE);
-        pango_layout_set_font_description(layout, desc);
-        pango_font_description_free(desc);
-    }
-#elif USE(PANGO)
-    if (font->primaryFont()->platformData().m_font) {
-        PangoFontDescription* desc = pango_font_describe(font->primaryFont()->platformData().m_font);
-        pango_layout_set_font_description(layout, desc);
-        pango_font_description_free(desc);
-    }
-#endif
-
-    pango_layout_set_auto_dir(layout, FALSE);
-
-    PangoContext* pangoContext = pango_layout_get_context(layout);
-    PangoDirection direction = run.rtl() ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR;
-    pango_context_set_base_dir(pangoContext, direction);
-    PangoAttrList* list = pango_attr_list_new();
-    PangoAttribute* attr;
-
-    attr = pango_attr_size_new_absolute(font->pixelSize() * PANGO_SCALE);
-    attr->end_index = G_MAXUINT;
-    pango_attr_list_insert_before(list, attr);
-
-    if (!run.spacingDisabled()) {
-        attr = pango_attr_letter_spacing_new(font->letterSpacing() * PANGO_SCALE);
-        attr->end_index = G_MAXUINT;
-        pango_attr_list_insert_before(list, attr);
-    }
-
-    // Pango does not yet support synthesising small caps
-    // See http://bugs.webkit.org/show_bug.cgi?id=15610
-
-    pango_layout_set_attributes(layout, list);
-    pango_attr_list_unref(list);
-}
-
-bool Font::canReturnFallbackFontsForComplexText()
-{
-    return false;
-}
-
-bool Font::canExpandAroundIdeographsInComplexText()
-{
-    return false;
-}
-
-static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, PangoLayoutLine* layoutLine, PangoRegionType renderRegion)
-{
-    ShadowBlur& shadow = graphicsContext->platformContext()->shadowBlur();
-
-    if (!(graphicsContext->textDrawingMode() & TextModeFill) || shadow.type() == ShadowBlur::NoShadow)
-        return;
-
-    FloatPoint totalOffset(point + graphicsContext->state().shadowOffset);
-
-    // Optimize non-blurry shadows, by just drawing text without the ShadowBlur.
-    if (!shadow.mustUseShadowBlur(graphicsContext)) {
-        cairo_t* context = graphicsContext->platformContext()->cr();
-        cairo_save(context);
-        cairo_translate(context, totalOffset.x(), totalOffset.y());
-
-        setSourceRGBAFromColor(context, graphicsContext->state().shadowColor);
-#if PLATFORM(GTK)
-        gdk_cairo_region(context, renderRegion);
-#else
-        appendRegionToCairoContext(context, renderRegion);
-#endif
-        cairo_clip(context);
-        pango_cairo_show_layout_line(context, layoutLine);
-
-        cairo_restore(context);
-        return;
-    }
-
-    FloatRect extents(getPangoRegionExtents(renderRegion));
-    extents.setLocation(FloatPoint(point.x(), point.y() - extents.height()));
-    if (GraphicsContext* shadowContext = shadow.beginShadowLayer(graphicsContext, extents)) {
-        cairo_t* cairoShadowContext = shadowContext->platformContext()->cr();
-        cairo_translate(cairoShadowContext, point.x(), point.y());
-        pango_cairo_show_layout_line(cairoShadowContext, layoutLine);
-
-        // We need the clipping region to be active when we blit the blurred shadow back,
-        // because we don't want any bits and pieces of characters out of range to be
-        // drawn. Since ShadowBlur expects a consistent transform, we have to undo the
-        // translation before calling endShadowLayer as well.
-        cairo_t* context = graphicsContext->platformContext()->cr();
-        cairo_save(context);
-        cairo_translate(context, totalOffset.x(), totalOffset.y());
-#if PLATFORM(GTK)
-        gdk_cairo_region(context, renderRegion);
-#else
-        appendRegionToCairoContext(context, renderRegion);
-#endif
-        cairo_clip(context);
-        cairo_translate(context, -totalOffset.x(), -totalOffset.y());
-
-        shadow.endShadowLayer(graphicsContext);
-        cairo_restore(context);
-    }
-}
-
-void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
-{
-#if USE(FREETYPE)
-    if (!primaryFont()->platformData().m_pattern) {
-        drawSimpleText(context, run, point, from, to);
-        return;
-    }
-#endif
-
-    cairo_t* cr = context->platformContext()->cr();
-    PangoLayout* layout = pango_cairo_create_layout(cr);
-    setPangoAttributes(this, run, layout);
-
-    gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
-    pango_layout_set_text(layout, utf8, -1);
-
-    // Our layouts are single line
-    PangoLayoutLine* layoutLine = pango_layout_get_line_readonly(layout, 0);
-
-    // Get the region where this text will be laid out. We will use it to clip
-    // the Cairo context, for when we are only painting part of the text run and
-    // to calculate the size of the shadow buffer.
-    PangoRegionType partialRegion = 0;
-    char* start = g_utf8_offset_to_pointer(utf8, from);
-    char* end = g_utf8_offset_to_pointer(start, to - from);
-    int ranges[] = {start - utf8, end - utf8};
-#if PLATFORM(GTK)
-    partialRegion = gdk_pango_layout_line_get_clip_region(layoutLine, 0, 0, ranges, 1);
-#else
-    partialRegion = getClipRegionFromPangoLayoutLine(layoutLine, ranges);
-#endif
-
-    drawGlyphsShadow(context, point, layoutLine, partialRegion);
-
-    cairo_save(cr);
-    cairo_translate(cr, point.x(), point.y());
-
-    float red, green, blue, alpha;
-    context->fillColor().getRGBA(red, green, blue, alpha);
-    cairo_set_source_rgba(cr, red, green, blue, alpha);
-#if PLATFORM(GTK)
-        gdk_cairo_region(cr, partialRegion);
-#else
-        appendRegionToCairoContext(cr, partialRegion);
-#endif
-    cairo_clip(cr);
-
-    pango_cairo_show_layout_line(cr, layoutLine);
-
-    if (context->textDrawingMode() & TextModeStroke) {
-        Color strokeColor = context->strokeColor();
-        strokeColor.getRGBA(red, green, blue, alpha);
-        cairo_set_source_rgba(cr, red, green, blue, alpha);
-        pango_cairo_layout_line_path(cr, layoutLine);
-        cairo_set_line_width(cr, context->strokeThickness());
-        cairo_stroke(cr);
-    }
-
-    // Pango sometimes leaves behind paths we don't want
-    cairo_new_path(cr);
-
-    destroyPangoRegion(partialRegion);
-    g_free(utf8);
-    g_object_unref(layout);
-
-    cairo_restore(cr);
-}
-
-void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
-{
-    notImplemented();
-}
-
-// We should create the layout with our actual context but we can't access it from here.
-static PangoLayout* getDefaultPangoLayout(const TextRun& run)
-{
-    static PangoFontMap* map = pango_cairo_font_map_get_default();
-#if PANGO_VERSION_CHECK(1, 21, 5)
-    static PangoContext* pangoContext = pango_font_map_create_context(map);
-#else
-    // Deprecated in Pango 1.21.
-    static PangoContext* pangoContext = pango_cairo_font_map_create_context(PANGO_CAIRO_FONT_MAP(map));
-#endif
-    PangoLayout* layout = pango_layout_new(pangoContext);
-
-    return layout;
-}
-
-float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* overflow) const
-{
-#if USE(FREETYPE)
-    if (!primaryFont()->platformData().m_pattern)
-        return floatWidthForSimpleText(run, fallbackFonts, overflow);
-#endif
-
-    if (!run.length())
-        return 0.0f;
-
-    PangoLayout* layout = getDefaultPangoLayout(run);
-    setPangoAttributes(this, run, layout);
-
-    gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
-    pango_layout_set_text(layout, utf8, -1);
-
-    int width;
-    pango_layout_get_pixel_size(layout, &width, 0);
-
-    g_free(utf8);
-    g_object_unref(layout);
-
-    return width;
-}
-
-int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const
-{
-#if USE(FREETYPE)
-    if (!primaryFont()->platformData().m_pattern)
-        return offsetForPositionForSimpleText(run, xFloat, includePartialGlyphs);
-#endif
-    // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
-    // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
-    int x = static_cast<int>(xFloat);
-
-    PangoLayout* layout = getDefaultPangoLayout(run);
-    setPangoAttributes(this, run, layout);
-
-    gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
-    pango_layout_set_text(layout, utf8, -1);
-
-    int index, trailing;
-    pango_layout_xy_to_index(layout, x * PANGO_SCALE, 1, &index, &trailing);
-    glong offset = g_utf8_pointer_to_offset(utf8, utf8 + index);
-    if (includePartialGlyphs)
-        offset += trailing;
-
-    g_free(utf8);
-    g_object_unref(layout);
-
-    return offset;
-}
-
-FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
-{
-#if USE(FREETYPE)
-    if (!primaryFont()->platformData().m_pattern)
-        return selectionRectForSimpleText(run, point, h, from, to);
-#endif
-
-    PangoLayout* layout = getDefaultPangoLayout(run);
-    setPangoAttributes(this, run, layout);
-
-    gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
-    pango_layout_set_text(layout, utf8, -1);
-
-    char* start = g_utf8_offset_to_pointer(utf8, from);
-    char* end = g_utf8_offset_to_pointer(start, to - from);
-
-    if (run.ltr()) {
-        from = start - utf8;
-        to = end - utf8;
-    } else {
-        from = end - utf8;
-        to = start - utf8;
-    }
-
-    PangoLayoutLine* layoutLine = pango_layout_get_line_readonly(layout, 0);
-    int xPos;
-
-    xPos = 0;
-    if (from < layoutLine->length)
-        pango_layout_line_index_to_x(layoutLine, from, FALSE, &xPos);
-    float beforeWidth = PANGO_PIXELS_FLOOR(xPos);
-
-    xPos = 0;
-    if (run.ltr() || to < layoutLine->length)
-        pango_layout_line_index_to_x(layoutLine, to, FALSE, &xPos);
-    float afterWidth = PANGO_PIXELS(xPos);
-
-    g_free(utf8);
-    g_object_unref(layout);
-
-    return FloatRect(point.x() + beforeWidth, point.y(), afterWidth - beforeWidth, h);
-}
-
-}
diff --git a/Source/WebCore/platform/graphics/pango/FontPlatformData.h b/Source/WebCore/platform/graphics/pango/FontPlatformData.h
deleted file mode 100644 (file)
index bd9251b..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Copyright (C) 2007 Holger Hans Peter Freyther
- * Copyright (C) 2007 Pioneer Research Center USA, Inc.
- * All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef FontPlatformDataPango_h
-#define FontPlatformDataPango_h
-
-#include "FontDescription.h"
-#include "FontOrientation.h"
-#include "GlyphBuffer.h"
-#include <cairo.h>
-#include <pango/pangocairo.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class FontPlatformData {
-public:
-    FontPlatformData(WTF::HashTableDeletedValueType)
-        : m_context(0)
-        , m_font(hashTableDeletedFontValue())
-        , m_size(0)
-        , m_syntheticBold(false)
-        , m_syntheticOblique(false)
-        , m_scaledFont(0)
-        { }
-
-    FontPlatformData()
-        : m_context(0)
-        , m_font(0)
-        , m_size(0)
-        , m_syntheticBold(false)
-        , m_syntheticOblique(false)
-        , m_scaledFont(0)
-        { }
-
-    FontPlatformData(const FontDescription&, const AtomicString& family);
-    FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool italic);
-    FontPlatformData(float size, bool bold, bool italic);
-    FontPlatformData(const FontPlatformData&);
-    ~FontPlatformData();
-
-    static bool init();
-    bool isFixedPitch();
-    float size() const { return m_size; }
-    void setSize(float size) { m_size = size; }
-    bool syntheticBold() const { return m_syntheticBold; }
-    bool syntheticOblique() const { return m_syntheticOblique; }
-
-    FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
-    void setOrientation(FontOrientation) { } // FIXME: Implement.
-
-    cairo_scaled_font_t* scaledFont() const { return m_scaledFont; }
-
-    unsigned hash() const
-    {
-        uintptr_t hashCodes[1] = { reinterpret_cast<uintptr_t>(m_scaledFont) };
-        return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
-    }
-
-    bool operator==(const FontPlatformData&) const;
-    FontPlatformData& operator=(const FontPlatformData&);
-    bool isHashTableDeletedValue() const
-    {
-        return m_font == hashTableDeletedFontValue();
-    }
-
-#ifndef NDEBUG
-    String description() const;
-#endif
-
-    static PangoFontMap* m_fontMap;
-    static GHashTable* m_hashTable;
-    PangoContext* m_context;
-    PangoFont* m_font;
-    float m_size;
-    bool m_syntheticBold;
-    bool m_syntheticOblique;
-    cairo_scaled_font_t* m_scaledFont;
-private:
-    static PangoFont *hashTableDeletedFontValue() { return reinterpret_cast<PangoFont*>(-1); }
-};
-
-}
-
-#endif // FontPlatformDataPango_h
diff --git a/Source/WebCore/platform/graphics/pango/FontPlatformDataPango.cpp b/Source/WebCore/platform/graphics/pango/FontPlatformDataPango.cpp
deleted file mode 100644 (file)
index 61cd042..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
- * Copyright (C) 2007 Holger Hans Peter Freyther
- * Copyright (C) 2007 Pioneer Research Center USA, Inc.
- * Copyright (C) 2009 Igalia S.L.
- * All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "config.h"
-#include "FontPlatformData.h"
-
-#include "FontDescription.h"
-#include <assert.h>
-#include <cairo.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-#include <pango/pango.h>
-#include <pango/pangocairo.h>
-
-// Use cairo-ft i a recent enough Pango version isn't available
-#if !PANGO_VERSION_CHECK(1,18,0)
-#include <cairo-ft.h>
-#include <pango/pangofc-fontmap.h>
-#endif
-
-namespace WebCore {
-
-PangoFontMap* FontPlatformData::m_fontMap = 0;
-GHashTable* FontPlatformData::m_hashTable = 0;
-
-FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const AtomicString& familyName)
-    : m_context(0)
-    , m_font(0)
-    , m_size(fontDescription.computedSize())
-    , m_syntheticBold(false)
-    , m_syntheticOblique(false)
-    , m_scaledFont(0)
-{
-    FontPlatformData::init();
-
-    CString stored_family = familyName.string().utf8();
-    char const* families[] = {
-      stored_family.data(),
-      NULL
-    };
-
-    switch (fontDescription.genericFamily()) {
-    case FontDescription::SerifFamily:
-        families[1] = "serif";
-        break;
-    case FontDescription::SansSerifFamily:
-        families[1] = "sans";
-        break;
-    case FontDescription::MonospaceFamily:
-        families[1] = "monospace";
-        break;
-    case FontDescription::NoFamily:
-    case FontDescription::StandardFamily:
-    default:
-        families[1] = "sans";
-        break;
-    }
-
-    PangoFontDescription* description = pango_font_description_new();
-    pango_font_description_set_absolute_size(description, fontDescription.computedSize() * PANGO_SCALE);
-
-    // FIXME: Map all FontWeight values to Pango font weights.
-    if (fontDescription.weight() >= FontWeight600)
-        pango_font_description_set_weight(description, PANGO_WEIGHT_BOLD);
-    if (fontDescription.italic())
-        pango_font_description_set_style(description, PANGO_STYLE_ITALIC);
-
-#if PANGO_VERSION_CHECK(1,21,5)   // deprecated in 1.21
-    m_context = pango_font_map_create_context(m_fontMap);
-#else
-    m_context = pango_cairo_font_map_create_context(PANGO_CAIRO_FONT_MAP(m_fontMap));
-#endif
-    for (unsigned int i = 0; !m_font && i < G_N_ELEMENTS(families); i++) {
-        pango_font_description_set_family(description, families[i]);
-        pango_context_set_font_description(m_context, description);
-        m_font = pango_font_map_load_font(m_fontMap, m_context, description);
-    }
-
-#if PANGO_VERSION_CHECK(1,18,0)
-    if (m_font)
-        m_scaledFont = cairo_scaled_font_reference(pango_cairo_font_get_scaled_font(PANGO_CAIRO_FONT(m_font)));
-#else
-    // This compatibility code for older versions of Pango is not well-tested.
-    if (m_font) {
-        PangoFcFont* fcfont = PANGO_FC_FONT(m_font);
-        cairo_font_face_t* face = cairo_ft_font_face_create_for_pattern(fcfont->font_pattern);
-        double size;
-        if (FcPatternGetDouble(fcfont->font_pattern, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)
-            size = 12.0;
-        cairo_matrix_t fontMatrix;
-        cairo_matrix_init_scale(&fontMatrix, size, size);
-        cairo_font_options_t* fontOptions;
-        if (pango_cairo_context_get_font_options(m_context))
-            fontOptions = cairo_font_options_copy(pango_cairo_context_get_font_options(m_context));
-        else
-            fontOptions = cairo_font_options_create();
-        cairo_matrix_t ctm;
-        cairo_matrix_init_identity(&ctm);
-        m_scaledFont = cairo_scaled_font_create(face, &fontMatrix, &ctm, fontOptions);
-        cairo_font_options_destroy(fontOptions);
-        cairo_font_face_destroy(face);
-    }
-#endif
-    pango_font_description_free(description);
-}
-
-FontPlatformData::FontPlatformData(float size, bool bold, bool italic)
-    : m_context(0)
-    , m_font(0)
-    , m_size(size)
-    , m_syntheticBold(bold)
-    , m_syntheticOblique(italic)
-    , m_scaledFont(0)
-{
-}
-
-FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool italic)
-    : m_context(0)
-    , m_font(0)
-    , m_size(size)
-    , m_syntheticBold(bold)
-    , m_syntheticOblique(italic)
-    , m_scaledFont(0)
-{
-    cairo_matrix_t fontMatrix;
-    cairo_matrix_init_scale(&fontMatrix, size, size);
-    cairo_matrix_t ctm;
-    cairo_matrix_init_identity(&ctm);
-    cairo_font_options_t* options = cairo_font_options_create();
-
-    // We force antialiasing and disable hinting to provide consistent
-    // typographic qualities for custom fonts on all platforms.
-    cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
-    cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
-
-    m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
-    cairo_font_options_destroy(options);
-}
-
-bool FontPlatformData::init()
-{
-    static bool initialized = false;
-    if (initialized)
-        return true;
-    initialized = true;
-
-    if (!m_fontMap)
-        m_fontMap = pango_cairo_font_map_get_default();
-    if (!m_hashTable) {
-        PangoFontFamily** families = 0;
-        int n_families = 0;
-
-        m_hashTable = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref);
-
-        pango_font_map_list_families(m_fontMap, &families, &n_families);
-
-        for (int family = 0; family < n_families; family++)
-                g_hash_table_insert(m_hashTable,
-                                    g_strdup(pango_font_family_get_name(families[family])),
-                                    g_object_ref(families[family]));
-
-        g_free(families);
-    }
-
-    return true;
-}
-
-FontPlatformData::~FontPlatformData()
-{
-    if (m_font && m_font != reinterpret_cast<PangoFont*>(-1)) {
-        g_object_unref(m_font);
-        m_font = 0;
-    }
-
-    if (m_context) {
-        g_object_unref(m_context);
-        m_context = 0;
-    }
-
-    if (m_scaledFont) {
-        cairo_scaled_font_destroy(m_scaledFont);
-        m_scaledFont = 0;
-    }
-}
-
-bool FontPlatformData::isFixedPitch()
-{
-    PangoFontDescription* description = pango_font_describe_with_absolute_size(m_font);
-    PangoFontFamily* family = reinterpret_cast<PangoFontFamily*>(g_hash_table_lookup(m_hashTable, pango_font_description_get_family(description)));
-    pango_font_description_free(description);
-    return pango_font_family_is_monospace(family);
-}
-
-FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
-{
-    // Check for self-assignment.
-    if (this == &other)
-        return *this;
-
-    m_size = other.m_size;
-    m_syntheticBold = other.m_syntheticBold;
-    m_syntheticOblique = other.m_syntheticOblique;
-
-    if (other.m_scaledFont)
-        cairo_scaled_font_reference(other.m_scaledFont);
-    if (m_scaledFont)
-        cairo_scaled_font_destroy(m_scaledFont);
-    m_scaledFont = other.m_scaledFont;
-
-    if (other.m_font)
-        g_object_ref(other.m_font);
-    if (m_font)
-        g_object_unref(m_font);
-    m_font = other.m_font;
-
-    if (other.m_context)
-        g_object_ref(other.m_context);
-    if (m_context)
-        g_object_unref(m_context);
-    m_context = other.m_context;
-
-    return *this;
-}
-
-FontPlatformData::FontPlatformData(const FontPlatformData& other)
-    : m_context(0)
-    , m_font(0)
-    , m_scaledFont(0)
-{
-    *this = other;
-}
-
-bool FontPlatformData::operator==(const FontPlatformData& other) const
-{
-    if (m_font == other.m_font)
-        return true;
-    if (m_font == 0 || m_font == reinterpret_cast<PangoFont*>(-1)
-        || other.m_font == 0 || other.m_font == reinterpret_cast<PangoFont*>(-1))
-        return false;
-    PangoFontDescription* thisDesc = pango_font_describe(m_font);
-    PangoFontDescription* otherDesc = pango_font_describe(other.m_font);
-    bool result = pango_font_description_equal(thisDesc, otherDesc);
-    pango_font_description_free(otherDesc);
-    pango_font_description_free(thisDesc);
-    return result;
-}
-
-#ifndef NDEBUG
-String FontPlatformData::description() const
-{
-    return String();
-}
-#endif
-
-}
diff --git a/Source/WebCore/platform/graphics/pango/GlyphPageTreeNodePango.cpp b/Source/WebCore/platform/graphics/pango/GlyphPageTreeNodePango.cpp
deleted file mode 100644 (file)
index 8d0baa6..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>
- * Copyright (C) 2007 Pioneer Research Center USA, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GlyphPageTreeNode.h"
-
-#include "SimpleFontData.h"
-#include <pango/pango-font.h>
-
-namespace WebCore {
-
-static PangoGlyph pango_font_get_glyph(PangoFont* font, PangoContext* context, gunichar wc)
-{
-    PangoGlyph result = 0;
-    gchar buffer[7];
-
-    gint  length = g_unichar_to_utf8(wc, buffer);
-    g_return_val_if_fail(length, 0);
-
-    GList* items = pango_itemize(context, buffer, 0, length, NULL, NULL);
-
-    if (g_list_length(items) == 1) {
-        PangoItem* item = reinterpret_cast<PangoItem*>(items->data);
-        PangoFont* tmpFont = item->analysis.font;
-        item->analysis.font = font;
-
-        PangoGlyphString* glyphs = pango_glyph_string_new();
-        pango_shape(buffer, length, &item->analysis, glyphs);
-
-        item->analysis.font = tmpFont;
-
-        if (glyphs->num_glyphs == 1)
-            result = glyphs->glyphs[0].glyph;
-        else
-            g_warning("didn't get 1 glyph but %d", glyphs->num_glyphs);
-
-        pango_glyph_string_free(glyphs);
-    }
-
-    g_list_foreach(items, (GFunc)pango_item_free, NULL);
-    g_list_free(items);
-
-    return result;
-}
-
-bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
-{
-    // The bufferLength will be greater than the glyph page size if the buffer has Unicode supplementary characters.
-    // We won't support this for now.
-    if (bufferLength > GlyphPage::size)
-        return false;
-
-    if (!fontData->platformData().m_font || fontData->platformData().m_font == reinterpret_cast<PangoFont*>(-1))
-        return false;
-
-    bool haveGlyphs = false;
-    for (unsigned i = 0; i < length; i++) {
-        Glyph glyph = pango_font_get_glyph(fontData->platformData().m_font, fontData->platformData().m_context, buffer[i]);
-        if (!glyph)
-            setGlyphDataForIndex(offset + i, 0, 0);
-        else {
-            setGlyphDataForIndex(offset + i, glyph, fontData);
-            haveGlyphs = true;
-        }
-    }
-
-    return haveGlyphs;
-}
-
-}
diff --git a/Source/WebCore/platform/graphics/pango/PangoUtilities.cpp b/Source/WebCore/platform/graphics/pango/PangoUtilities.cpp
deleted file mode 100644 (file)
index 98dc11b..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * This code was mostly copied from gdk-pango.
- * source: http://git.gnome.org/browse/gtk+/tree/gdk/gdkpango.c
- *
- * Copyright (C) 2000 Red Hat, Inc.
- * Copyright (C) 2011 ProFUSION embedded systems
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include "PangoUtilities.h"
-
-#include <cairo.h>
-#include <pango/pango.h>
-
-namespace WebCore {
-
-static cairo_region_t* getLineClipRegionFromLayoutIter(PangoLayoutIter* iter, const int* indexRange)
-{
-    PangoRectangle logicalRect;
-    PangoLayoutLine* line = pango_layout_iter_get_line_readonly(iter);
-    cairo_region_t* clipRegion = cairo_region_create();
-    pango_layout_iter_get_line_extents(iter, 0, &logicalRect);
-    int baseline = pango_layout_iter_get_baseline(iter);
-
-    int* pixelRanges = 0;
-    int pixelRangeCount = 0;
-
-    if (indexRange[1] >= line->start_index
-        && indexRange[0] < line->start_index + line->length)
-        pango_layout_line_get_x_ranges(line,
-                                       indexRange[0],
-                                       indexRange[1],
-                                       &pixelRanges, &pixelRangeCount);
-
-    for (int j = 0; j < pixelRangeCount; ++j) {
-        int offsetX = PANGO_PIXELS(pixelRanges[2 * j] - logicalRect.x);
-        int offsetY = PANGO_PIXELS(baseline - logicalRect.y);
-
-        cairo_rectangle_int_t rect;
-        rect.x = offsetX;
-        rect.y = -offsetY;
-        rect.width = PANGO_PIXELS(pixelRanges[2 * j + 1] - logicalRect.x) - offsetX;
-        rect.height = PANGO_PIXELS(baseline - logicalRect.y + logicalRect.height) - offsetY;
-
-        cairo_region_union_rectangle(clipRegion, &rect);
-    }
-
-    free(pixelRanges);
-
-    return clipRegion;
-}
-
-cairo_region_t* getClipRegionFromPangoLayoutLine(PangoLayoutLine* line, const int* indexRange)
-{
-    if (!indexRange)
-        return 0;
-
-    PangoLayoutIter* iter = pango_layout_get_iter(line->layout);
-    while (pango_layout_iter_get_line_readonly(iter) != line)
-        pango_layout_iter_next_line(iter);
-
-    cairo_region_t* clipRegion = getLineClipRegionFromLayoutIter(iter, indexRange);
-
-    pango_layout_iter_free(iter);
-
-    return clipRegion;
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/pango/PangoUtilities.h b/Source/WebCore/platform/graphics/pango/PangoUtilities.h
deleted file mode 100644 (file)
index b800676..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc.
- * Copyright (C) 2011 ProFUSION embedded systems
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef PangoUtilities_h
-#define PangoUtilities_h
-
-#include "GraphicsTypes.h"
-
-typedef struct _PangoLayoutLine PangoLayoutLine;
-typedef struct _cairo_region cairo_region_t;
-
-namespace WebCore {
-
-cairo_region_t* getClipRegionFromPangoLayoutLine(PangoLayoutLine*, const int* indexRange);
-
-} // namespace WebCore
-
-#endif // PangoUtilities_h
diff --git a/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp b/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
deleted file mode 100644 (file)
index f88cbbb..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
- * Copyright (C) 2007 Holger Hans Peter Freyther
- * Copyright (C) 2007 Pioneer Research Center USA, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "SimpleFontData.h"
-
-#include "FloatRect.h"
-#include "Font.h"
-#include "FontCache.h"
-#include "FontDescription.h"
-#include "GlyphBuffer.h"
-#include <cairo.h>
-#include <wtf/MathExtras.h>
-
-namespace WebCore {
-
-void SimpleFontData::platformInit()
-{
-    cairo_font_extents_t font_extents;
-    cairo_text_extents_t text_extents;
-    cairo_scaled_font_extents(m_platformData.m_scaledFont, &font_extents);
-
-    m_fontMetrics.setAscent(font_extents.ascent);
-    m_fontMetrics.setDescent(font_extents.descent);
-
-    // There seems to be some rounding error in cairo (or in how we
-    // use cairo) with some fonts, like DejaVu Sans Mono, which makes
-    // cairo report a height smaller than ascent + descent, which is
-    // wrong and confuses WebCore's layout system. Workaround this
-    // while we figure out what's going on.
-    float lineSpacing = font_extents.height;
-    if (lineSpacing < font_extents.ascent + font_extents.descent)
-        lineSpacing = font_extents.ascent + font_extents.descent;
-    m_fontMetrics.setLineSpacing(lroundf(lineSpacing));
-    m_fontMetrics.setLineGap(lineSpacing - font_extents.ascent - font_extents.descent);
-
-    cairo_scaled_font_text_extents(m_platformData.m_scaledFont, "x", &text_extents);
-    m_fontMetrics.setXHeight(text_extents.height);
-
-    cairo_scaled_font_text_extents(m_platformData.m_scaledFont, " ", &text_extents);
-    m_spaceWidth = static_cast<float>(text_extents.x_advance);
-    
-    m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
-}
-
-void SimpleFontData::platformCharWidthInit()
-{
-    m_avgCharWidth = 0.f;
-    m_maxCharWidth = 0.f;
-    initCharWidths();
-}
-
-void SimpleFontData::platformDestroy()
-{
-}
-
-PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
-{
-    FontDescription desc = FontDescription(fontDescription);
-    desc.setSpecifiedSize(scaleFactor * fontDescription.computedSize());
-    FontPlatformData platformData(desc, desc.family().family());
-    return SimpleFontData::create(platformData);
-}
-
-bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
-{
-    bool result = true;
-
-    PangoCoverage* coverage = pango_font_get_coverage(m_platformData.m_font, pango_language_get_default());
-
-    for (int i = 0; i < length; i++) {
-        if (PANGO_COVERAGE_NONE == pango_coverage_get(coverage, characters[i])) {
-            result = false;
-            break;
-        }
-    }
-
-    pango_coverage_unref(coverage);
-
-    return result;
-}
-
-void SimpleFontData::determinePitch()
-{
-    if (isCustomFont()) {
-        m_treatAsFixedPitch = false;
-        return;
-    }
-
-    m_treatAsFixedPitch = m_platformData.isFixedPitch();
-}
-
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
-{
-    return FloatRect();
-}
-
-float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
-{
-    ASSERT(m_platformData.m_scaledFont);
-
-    cairo_glyph_t cglyph = { glyph, 0, 0 };
-    cairo_text_extents_t extents;
-    cairo_scaled_font_glyph_extents(m_platformData.m_scaledFont, &cglyph, 1, &extents);
-
-    float width = (float)m_spaceWidth;
-    if (cairo_scaled_font_status(m_platformData.m_scaledFont) == CAIRO_STATUS_SUCCESS && extents.x_advance != 0)
-        width = (float)extents.x_advance;
-
-    return width;    
-}
-
-}
index 0ef8608..ad2b494 100644 (file)
@@ -917,19 +917,6 @@ AC_SUBST([G_IR_SCANNER])
 AC_SUBST([G_IR_COMPILER])
 AC_SUBST([G_IR_GENERATE])
 
-# determine the font backend
-AC_MSG_CHECKING([the font backend to use])
-AC_ARG_WITH(font_backend,
-            AC_HELP_STRING([--with-font-backend=@<:@freetype/pango@:>@],
-                           [Select font backend [default=freetype]]),
-            [],[with_font_backend="freetype"])
-
-case "$with_font_backend" in
-     freetype|pango) ;;
-     *) AC_MSG_ERROR([Invalid font backend: must be freetype or pango.]) ;;
-esac
-AC_MSG_RESULT([$with_font_backend])
-
 if test "$host_cpu" = "sh4"; then
    CXXFLAGS="$CXXFLAGS -mieee -w"
    CFLAGS="$CFLAGS -mieee -w"
@@ -967,22 +954,20 @@ AC_SUBST([LIBSECRET_CFLAGS])
 AC_SUBST([LIBSECRET_LIBS])
 
 # check if FreeType/FontConfig are available
-if test "$with_font_backend" = "freetype"; then
-   if test "$with_target" = "directfb"; then
-   PKG_CHECK_MODULES([FREETYPE],
-                     [fontconfig >= $FONTCONFIG_REQUIRED_VERSION
-                     freetype2 >= $FREETYPE2_REQUIRED_VERSION
-                     harfbuzz])
-   else
-   PKG_CHECK_MODULES([FREETYPE],
-                     [cairo-ft
-                     fontconfig >= $FONTCONFIG_REQUIRED_VERSION
-                     freetype2 >= $FREETYPE2_REQUIRED_VERSION
-                     harfbuzz])
-   fi
-   AC_SUBST([FREETYPE_CFLAGS])
-   AC_SUBST([FREETYPE_LIBS])
+if test "$with_target" = "directfb"; then
+PKG_CHECK_MODULES([FREETYPE],
+                  [fontconfig >= $FONTCONFIG_REQUIRED_VERSION
+                  freetype2 >= $FREETYPE2_REQUIRED_VERSION
+                  harfbuzz])
+else
+PKG_CHECK_MODULES([FREETYPE],
+                  [cairo-ft
+                  fontconfig >= $FONTCONFIG_REQUIRED_VERSION
+                  freetype2 >= $FREETYPE2_REQUIRED_VERSION
+                  harfbuzz])
 fi
+AC_SUBST([FREETYPE_CFLAGS])
+AC_SUBST([FREETYPE_LIBS])
 
 # check if SQLite3 is available. Error out only if one of the
 # features hard-depending on it is enabled while SQLite3 is
@@ -1169,10 +1154,6 @@ AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"])
 AM_CONDITIONAL([USE_ICU_UNICODE], [test "$with_unicode_backend" = "icu"])
 AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"])
 
-# Font backend conditionals
-AM_CONDITIONAL([USE_FREETYPE], [test "$with_font_backend" = "freetype"])
-AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"])
-
 # GStreamer feature conditional
 AM_CONDITIONAL([USE_GSTREAMER], [test "$have_gstreamer" = "yes"])
 AM_CONDITIONAL([USE_WEBAUDIO_GSTREAMER], [test "$enable_web_audio" = "yes"])
@@ -1271,7 +1252,6 @@ Build configuration:
  Enable GCC build optimization                            : $enable_optimizations
  Code coverage support                                    : $enable_coverage
  Unicode backend                                          : $with_unicode_backend
- Font backend                                             : $with_font_backend
  Optimized memory allocator                               : $enable_fast_malloc
  Accelerated rendering backend                            : $acceleration_backend_description