Diff
Modified: trunk/ChangeLog (123863 => 123864)
--- trunk/ChangeLog 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/ChangeLog 2012-07-27 11:32:44 UTC (rev 123864)
@@ -1,3 +1,15 @@
+2012-07-27 Dominik Röttsches <[email protected]>
+
+ [Cairo] Add complex font drawing using HarfbuzzNG
+ https://bugs.webkit.org/show_bug.cgi?id=91864
+
+ Reviewed by Simon Hausmann and Martin Robinson.
+
+ Configuring Freetype backend to use HarfBuzz by default.
+
+ * Source/cmake/FindHarfBuzz.cmake: Added pkgconfig based discovery of HarfBuzz.
+ * Source/cmake/OptionsEfl.cmake: Adding Harfbuzz configuration.
+
2012-07-26 Dan Bernstein <[email protected]>
When Safari 6 is launched via the WebKit Xcode workspace, it does not link against the built frameworks
Modified: trunk/Source/WebCore/CMakeLists.txt (123863 => 123864)
--- trunk/Source/WebCore/CMakeLists.txt 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-07-27 11:32:44 UTC (rev 123864)
@@ -48,6 +48,8 @@
"${WEBCORE_DIR}/platform/graphics"
"${WEBCORE_DIR}/platform/graphics/filters"
"${WEBCORE_DIR}/platform/graphics/filters/arm"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
"${WEBCORE_DIR}/platform/graphics/transforms"
"${WEBCORE_DIR}/platform/image-decoders"
"${WEBCORE_DIR}/platform/image-decoders/bmp"
Modified: trunk/Source/WebCore/ChangeLog (123863 => 123864)
--- trunk/Source/WebCore/ChangeLog 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebCore/ChangeLog 2012-07-27 11:32:44 UTC (rev 123864)
@@ -1,3 +1,53 @@
+2012-07-27 Dominik Röttsches <[email protected]>
+
+ [Cairo] Add complex font drawing using HarfbuzzNG
+ https://bugs.webkit.org/show_bug.cgi?id=91864
+
+ Reviewed by Simon Hausmann and Martin Robinson.
+
+ Adding Harfbuzz support to EFL by implementing it with the help of cairo and cairo-ft.
+ Reusing Chromium's Harfbuzz-NG support.
+
+ No new tests, complex font support is covered by existing tests.
+
+ * CMakeLists.txt: Adding new cairo based implementations, removing emtpy FontEfl.cpp
+ * WebCore.gypi: Removing FontEfl.cpp
+ * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: Added. New implementation that implements cairo & harfbuzz-ng based complex font drawing.
+ (WebCore):
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::drawEmphasisMarksForComplexText):
+ (WebCore::Font::canReturnFallbackFontsForComplexText):
+ (WebCore::Font::canExpandAroundIdeographsInComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::Font::offsetForPositionForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+ * platform/graphics/efl/FontEfl.cpp: Removed.
+ * platform/graphics/freetype/FontPlatformData.h: Adding a getter that retrieves a harfbuzz face.
+ (FontPlatformData):
+ * platform/graphics/freetype/FontPlatformDataFreeType.cpp: Adding a getter that retrieves a harfbuzz face.
+ (WebCore::FontPlatformData::operator=):
+ (WebCore::FontPlatformData::FontPlatformData):
+ (WebCore):
+ (WebCore::FontPlatformData::harfbuzzFace):
+ * platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp: Added. Cairo-freetype based approach to get complex font metrics.
+ (WebCore):
+ (CairoFtFaceLocker):
+ (WebCore::CairoFtFaceLocker::CairoFtFaceLocker):
+ (WebCore::CairoFtFaceLocker::lock):
+ (WebCore::CairoFtFaceLocker::~CairoFtFaceLocker):
+ (WebCore::floatToHarfBuzzPosition):
+ (WebCore::doubleToHarfBuzzPosition):
+ (WebCore::CairoGetGlyphWidthAndExtents):
+ (WebCore::harfbuzzGetGlyph):
+ (WebCore::harfbuzzGetGlyphHorizontalAdvance):
+ (WebCore::harfbuzzGetGlyphHorizontalOrigin):
+ (WebCore::harfbuzzGetGlyphExtents):
+ (WebCore::harfbuzzCairoTextGetFontFuncs):
+ (WebCore::harfbuzzCairoGetTable):
+ (WebCore::HarfBuzzNGFace::createFace):
+ (WebCore::HarfBuzzNGFace::createFont):
+ (WebCore::HarfBuzzShaper::createGlyphBufferAdvance):
+
2012-07-27 Adam Barth <[email protected]>
Add a Setting to expose quantized, rate-limited MemoryInfo values
Modified: trunk/Source/WebCore/PlatformEfl.cmake (123863 => 123864)
--- trunk/Source/WebCore/PlatformEfl.cmake 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebCore/PlatformEfl.cmake 2012-07-27 11:32:44 UTC (rev 123864)
@@ -149,16 +149,25 @@
IF (WTF_USE_FREETYPE)
LIST(APPEND WebCore_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/platform/graphics/freetype"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz/"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
)
LIST(APPEND WebCore_SOURCES
platform/graphics/WOFFFileFormat.cpp
- platform/graphics/efl/FontEfl.cpp
+ platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
platform/graphics/freetype/FontCacheFreeType.cpp
platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
platform/graphics/freetype/FontPlatformDataFreeType.cpp
platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
platform/graphics/freetype/SimpleFontDataFreeType.cpp
+ platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp
+ platform/graphics/harfbuzz/ng/HarfBuzzNGFace.cpp
+ platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp
+ platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp
)
+ LIST(APPEND WebCore_LIBRARIES
+ ${HARFBUZZ_LIBRARIES}
+ )
ENDIF ()
IF (WTF_USE_PANGO)
Modified: trunk/Source/WebCore/WebCore.gypi (123863 => 123864)
--- trunk/Source/WebCore/WebCore.gypi 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebCore/WebCore.gypi 2012-07-27 11:32:44 UTC (rev 123864)
@@ -3658,7 +3658,6 @@
'platform/graphics/chromium/VDMXParser.cpp',
'platform/graphics/chromium/VDMXParser.h',
'platform/graphics/cocoa/FontPlatformDataCocoa.mm',
- 'platform/graphics/efl/FontEfl.cpp',
'platform/graphics/efl/IconEfl.cpp',
'platform/graphics/efl/ImageEfl.cpp',
'platform/graphics/efl/IntPointEfl.cpp',
Added: trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (0 => 123864)
--- trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 2012-07-27 11:32:44 UTC (rev 123864)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Intel Corporation
+ *
+ * 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 "GraphicsContext.h"
+#include "HarfBuzzShaper.h"
+#include "Logging.h"
+#include "NotImplemented.h"
+#include "PlatformContextCairo.h"
+#include "SimpleFontData.h"
+#include <cairo.h>
+
+namespace WebCore {
+
+void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
+{
+ GlyphBuffer glyphBuffer;
+ HarfBuzzShaper shaper(this, run);
+ if (shaper.shape(&glyphBuffer))
+ drawGlyphBuffer(context, run, glyphBuffer, point);
+ else
+ LOG_ERROR("Shaper couldn't shape glyphBuffer.");
+}
+
+void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
+{
+ notImplemented();
+}
+
+bool Font::canReturnFallbackFontsForComplexText()
+{
+ return false;
+}
+
+bool Font::canExpandAroundIdeographsInComplexText()
+{
+ return false;
+}
+
+float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
+{
+ HarfBuzzShaper shaper(this, run);
+ if (shaper.shape())
+ return shaper.totalWidth();
+ LOG_ERROR("Shaper couldn't shape text run.");
+ return 0;
+}
+
+int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool) const
+{
+ HarfBuzzShaper shaper(this, run);
+ if (shaper.shape())
+ return shaper.offsetForPosition(x);
+ LOG_ERROR("Shaper couldn't shape text run.");
+ return 0;
+}
+
+FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
+{
+ HarfBuzzShaper shaper(this, run);
+ if (shaper.shape())
+ return shaper.selectionRect(point, h, from, to);
+ LOG_ERROR("Shaper couldn't shape text run.");
+ return FloatRect();
+}
+
+}
Deleted: trunk/Source/WebCore/platform/graphics/efl/FontEfl.cpp (123863 => 123864)
--- trunk/Source/WebCore/platform/graphics/efl/FontEfl.cpp 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebCore/platform/graphics/efl/FontEfl.cpp 2012-07-27 11:32:44 UTC (rev 123864)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll ([email protected])
- * Copyright (C) 1999 Antti Koivisto ([email protected])
- * Copyright (C) 2000 Dirk Mueller ([email protected])
- * Copyright (C) 2003, 2006 Apple Inc. All rights reserved.
- * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
- * Copyright (C) 2009-2010 ProFUSION embedded systems
- * Copyright (C) 2009-2010 Samsung Electronics
- *
- * 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 "Font.h"
-
-#include "GraphicsContext.h"
-#include "NotImplemented.h"
-#include "SimpleFontData.h"
-
-#include <cairo.h>
-
-namespace WebCore {
-
-void Font::drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const
-{
- notImplemented();
-}
-
-void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
-{
- notImplemented();
-}
-
-bool Font::canReturnFallbackFontsForComplexText()
-{
- return false;
-}
-
-bool Font::canExpandAroundIdeographsInComplexText()
-{
- return false;
-}
-
-float Font::floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
-{
- notImplemented();
- return 0.0f;
-}
-
-int Font::offsetForPositionForComplexText(const TextRun&, float, bool) const
-{
- notImplemented();
- return 0;
-}
-
-FloatRect Font::selectionRectForComplexText(const TextRun&, const FloatPoint&, int, int, int) const
-{
- notImplemented();
- return FloatRect();
-}
-
-}
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h (123863 => 123864)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h 2012-07-27 11:32:44 UTC (rev 123864)
@@ -29,11 +29,15 @@
#include "FontDescription.h"
#include "FontOrientation.h"
#include "GlyphBuffer.h"
+#if USE(HARFBUZZ_NG)
+#include "HarfBuzzNGFace.h"
+#endif
#include "RefPtrCairo.h"
#include <wtf/Forward.h>
#include <wtf/HashFunctions.h>
typedef struct _FcFontSet FcFontSet;
+class HarfBuzzNGFace;
namespace WebCore {
@@ -63,6 +67,10 @@
~FontPlatformData();
+#if USE(HARFBUZZ_NG)
+ HarfBuzzNGFace* harfbuzzFace() const;
+#endif
+
bool isFixedPitch();
float size() const { return m_size; }
void setSize(float size) { m_size = size; }
@@ -98,6 +106,9 @@
bool m_syntheticOblique;
bool m_fixedWidth;
cairo_scaled_font_t* m_scaledFont;
+#if USE(HARFBUZZ_NG)
+ mutable RefPtr<HarfBuzzNGFace> m_harfbuzzFace;
+#endif
private:
void initializeWithFontFace(cairo_font_face_t*, const FontDescription& = FontDescription());
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (123863 => 123864)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2012-07-27 11:32:44 UTC (rev 123864)
@@ -186,17 +186,27 @@
cairo_scaled_font_destroy(m_scaledFont);
m_scaledFont = cairo_scaled_font_reference(other.m_scaledFont);
+#if USE(HARFBUZZ_NG)
+ m_harfbuzzFace = other.m_harfbuzzFace;
+#endif
+
return *this;
}
FontPlatformData::FontPlatformData(const FontPlatformData& other)
: m_fallbacks(0)
, m_scaledFont(0)
+#if USE(HARFBUZZ_NG)
+ , m_harfbuzzFace(other.m_harfbuzzFace)
+#endif
{
*this = other;
}
FontPlatformData::FontPlatformData(const FontPlatformData& other, float size)
+#if USE(HARFBUZZ_NG)
+ : m_harfbuzzFace(other.m_harfbuzzFace)
+#endif
{
*this = other;
@@ -217,6 +227,16 @@
cairo_scaled_font_destroy(m_scaledFont);
}
+#if USE(HARFBUZZ_NG)
+HarfBuzzNGFace* FontPlatformData::harfbuzzFace() const
+{
+ if (!m_harfbuzzFace)
+ m_harfbuzzFace = HarfBuzzNGFace::create(const_cast<FontPlatformData*>(this), hash());
+
+ return m_harfbuzzFace.get();
+}
+#endif
+
bool FontPlatformData::isFixedPitch()
{
return m_fixedWidth;
Added: trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp (0 => 123864)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp 2012-07-27 11:32:44 UTC (rev 123864)
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2012 Google Inc. All rights reserved.
+ * Copyright (c) 2012 Intel Corporation
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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 "HarfBuzzNGFace.h"
+
+#include "FontPlatformData.h"
+#include "GlyphBuffer.h"
+#include "HarfBuzzShaper.h"
+#include "SimpleFontData.h"
+#include "TextEncoding.h"
+#include <cairo-ft.h>
+#include <cairo.h>
+#include <freetype/freetype.h>
+#include <freetype/tttables.h>
+#include <hb.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+class CairoFtFaceLocker {
+public:
+ CairoFtFaceLocker(cairo_scaled_font_t* cairoScaledFont) : m_scaledFont(cairoScaledFont) { };
+ FT_Face lock()
+ {
+ return cairo_ft_scaled_font_lock_face(m_scaledFont);
+ };
+ ~CairoFtFaceLocker()
+ {
+ cairo_ft_scaled_font_unlock_face(m_scaledFont);
+ }
+private:
+ cairo_scaled_font_t* m_scaledFont;
+};
+
+static hb_position_t floatToHarfBuzzPosition(float value)
+{
+ return static_cast<hb_position_t>(value * (1 << 16));
+}
+
+static hb_position_t doubleToHarfBuzzPosition(double value)
+{
+ return static_cast<hb_position_t>(value * (1 << 16));
+}
+
+static void CairoGetGlyphWidthAndExtents(cairo_scaled_font_t* scaledFont, hb_codepoint_t codepoint, hb_position_t* advance, hb_glyph_extents_t* extents)
+{
+ cairo_text_extents_t glyphExtents;
+ cairo_glyph_t glyph;
+ glyph.index = codepoint;
+ glyph.x = 0;
+ glyph.y = 0;
+ cairo_scaled_font_glyph_extents(scaledFont, &glyph, 1, &glyphExtents);
+
+ if (advance)
+ *advance = doubleToHarfBuzzPosition(glyphExtents.x_advance);
+ if (extents) {
+ extents->x_bearing = doubleToHarfBuzzPosition(glyphExtents.x_bearing);
+ extents->y_bearing = doubleToHarfBuzzPosition(glyphExtents.y_bearing);
+ extents->width = doubleToHarfBuzzPosition(glyphExtents.width);
+ extents->height = doubleToHarfBuzzPosition(glyphExtents.height);
+ }
+}
+
+static hb_bool_t harfbuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoint_t unicode, hb_codepoint_t variationSelector, hb_codepoint_t* glyph, void* userData)
+{
+ FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData);
+ cairo_scaled_font_t* scaledFont = platformData->scaledFont();
+ ASSERT(scaledFont);
+ CairoFtFaceLocker cairoFtFaceLocker(scaledFont);
+ FT_Face ftFace = cairoFtFaceLocker.lock();
+ ASSERT(ftFace);
+ *glyph = FT_Get_Char_Index(ftFace, unicode);
+ return !!*glyph;
+}
+
+static hb_position_t harfbuzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, void* userData)
+{
+ FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData);
+ cairo_scaled_font_t* scaledFont = platformData->scaledFont();
+ ASSERT(scaledFont);
+
+ hb_position_t advance = 0;
+ CairoGetGlyphWidthAndExtents(scaledFont, glyph, &advance, 0);
+ return advance;
+}
+
+static hb_bool_t harfbuzzGetGlyphHorizontalOrigin(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_position_t* x, hb_position_t* y, void* userData)
+{
+ // Just return true, following the way that Harfbuzz-FreeType
+ // implementation does.
+ return true;
+}
+
+static hb_bool_t harfbuzzGetGlyphExtents(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_glyph_extents_t* extents, void* userData)
+{
+ FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData);
+ cairo_scaled_font_t* scaledFont = platformData->scaledFont();
+ ASSERT(scaledFont);
+
+ CairoGetGlyphWidthAndExtents(scaledFont, glyph, 0, extents);
+ return true;
+}
+
+static hb_font_funcs_t* harfbuzzCairoTextGetFontFuncs()
+{
+ static hb_font_funcs_t* harfbuzzCairoFontFuncs = 0;
+
+ // We don't set callback functions which we can't support.
+ // Harfbuzz will use the fallback implementation if they aren't set.
+ if (!harfbuzzCairoFontFuncs) {
+ harfbuzzCairoFontFuncs = hb_font_funcs_create();
+ hb_font_funcs_set_glyph_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyph, 0, 0);
+ hb_font_funcs_set_glyph_h_advance_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyphHorizontalAdvance, 0, 0);
+ hb_font_funcs_set_glyph_h_origin_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyphHorizontalOrigin, 0, 0);
+ hb_font_funcs_set_glyph_extents_func(harfbuzzCairoFontFuncs, harfbuzzGetGlyphExtents, 0, 0);
+ hb_font_funcs_make_immutable(harfbuzzCairoFontFuncs);
+ }
+ return harfbuzzCairoFontFuncs;
+}
+
+static hb_blob_t* harfbuzzCairoGetTable(hb_face_t* face, hb_tag_t tag, void* userData)
+{
+ FontPlatformData* font = reinterpret_cast<FontPlatformData*>(userData);
+
+ cairo_scaled_font_t* scaledFont = font->scaledFont();
+ if (!scaledFont)
+ return 0;
+
+ CairoFtFaceLocker cairoFtFaceLocker(scaledFont);
+ FT_Face ftFont = cairoFtFaceLocker.lock();
+ if (!ftFont)
+ return 0;
+
+ FT_ULong tableSize = 0;
+ FT_Error error = FT_Load_Sfnt_Table(ftFont, tag, 0, 0, &tableSize);
+ if (error)
+ return 0;
+
+ FT_Byte* buffer = reinterpret_cast<FT_Byte*>(fastMalloc(tableSize));
+ if (!buffer)
+ return 0;
+ FT_ULong expectedTableSize = tableSize;
+ error = FT_Load_Sfnt_Table(ftFont, tag, 0, buffer, &tableSize);
+ if (error || tableSize != expectedTableSize) {
+ fastFree(buffer);
+ return 0;
+ }
+
+ return hb_blob_create(reinterpret_cast<const char*>(buffer), tableSize, HB_MEMORY_MODE_WRITABLE, buffer, fastFree);
+}
+
+hb_face_t* HarfBuzzNGFace::createFace()
+{
+ hb_face_t* face = hb_face_create_for_tables(harfbuzzCairoGetTable, m_platformData, 0);
+ ASSERT(face);
+ return face;
+}
+
+hb_font_t* HarfBuzzNGFace::createFont()
+{
+ hb_font_t* font = hb_font_create(m_face);
+ hb_font_set_funcs(font, harfbuzzCairoTextGetFontFuncs(), m_platformData, 0);
+ const float size = m_platformData->size();
+ if (floorf(size) == size)
+ hb_font_set_ppem(font, size, size);
+ int scale = floatToHarfBuzzPosition(size);
+ hb_font_set_scale(font, scale, scale);
+ hb_font_make_immutable(font);
+ return font;
+}
+
+GlyphBufferAdvance HarfBuzzShaper::createGlyphBufferAdvance(float width, float height)
+{
+ return GlyphBufferAdvance(width, height);
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebKit/CMakeLists.txt (123863 => 123864)
--- trunk/Source/WebKit/CMakeLists.txt 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebKit/CMakeLists.txt 2012-07-27 11:32:44 UTC (rev 123864)
@@ -29,6 +29,8 @@
"${WEBCORE_DIR}/platform/animation"
"${WEBCORE_DIR}/platform/graphics"
"${WEBCORE_DIR}/platform/graphics/filters"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
"${WEBCORE_DIR}/platform/graphics/transforms"
"${WEBCORE_DIR}/platform/network"
"${WEBCORE_DIR}/platform/sql"
Modified: trunk/Source/WebKit/ChangeLog (123863 => 123864)
--- trunk/Source/WebKit/ChangeLog 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebKit/ChangeLog 2012-07-27 11:32:44 UTC (rev 123864)
@@ -1,3 +1,14 @@
+2012-07-27 Dominik Röttsches <[email protected]>
+
+ [Cairo] Add complex font drawing using HarfbuzzNG
+ https://bugs.webkit.org/show_bug.cgi?id=91864
+
+ Reviewed by Simon Hausmann and Martin Robinson.
+
+ Adding includes for harfbuzz folders.
+
+ * CMakeLists.txt:
+
2012-07-26 Christophe Dumez <[email protected]>
[EFL][WK2] Implement Network Information provider
Modified: trunk/Source/WebKit2/CMakeLists.txt (123863 => 123864)
--- trunk/Source/WebKit2/CMakeLists.txt 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebKit2/CMakeLists.txt 2012-07-27 11:32:44 UTC (rev 123864)
@@ -69,6 +69,8 @@
"${WEBCORE_DIR}/platform/animation"
"${WEBCORE_DIR}/platform/graphics"
"${WEBCORE_DIR}/platform/graphics/filters"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz"
+ "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
"${WEBCORE_DIR}/platform/graphics/transforms"
"${WEBCORE_DIR}/platform/network"
"${WEBCORE_DIR}/platform/sql"
Modified: trunk/Source/WebKit2/ChangeLog (123863 => 123864)
--- trunk/Source/WebKit2/ChangeLog 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-27 11:32:44 UTC (rev 123864)
@@ -1,3 +1,14 @@
+2012-07-27 Dominik Röttsches <[email protected]>
+
+ [Cairo] Add complex font drawing using HarfbuzzNG
+ https://bugs.webkit.org/show_bug.cgi?id=91864
+
+ Reviewed by Simon Hausmann and Martin Robinson.
+
+ Adding includes for harfbuzz folders.
+
+ * CMakeLists.txt:
+
2012-07-27 Christophe Dumez <[email protected]>
[EFL][WK2] Add more Ewk_View unit tests
Added: trunk/Source/cmake/FindHarfBuzz.cmake (0 => 123864)
--- trunk/Source/cmake/FindHarfBuzz.cmake (rev 0)
+++ trunk/Source/cmake/FindHarfBuzz.cmake 2012-07-27 11:32:44 UTC (rev 123864)
@@ -0,0 +1,44 @@
+# Copyright (c) 2012, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# * 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.
+# * Neither the name of Intel Corporation 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT OWNER 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(FindPkgConfig)
+
+PKG_CHECK_MODULES (harfbuzz REQUIRED harfbuzz>=0.9.0)
+
+PKG_CHECK_MODULES(PC_HARFBUZZ harfbuzz>=0.9.0)
+
+FIND_PATH(HARFBUZZ_INCLUDE_DIRS NAMES hb.h
+ HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
+)
+
+FIND_LIBRARY(HARFBUZZ_LIBRARIES NAMES harfbuzz
+ HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES)
Modified: trunk/Source/cmake/OptionsEfl.cmake (123863 => 123864)
--- trunk/Source/cmake/OptionsEfl.cmake 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Source/cmake/OptionsEfl.cmake 2012-07-27 11:32:44 UTC (rev 123864)
@@ -119,8 +119,11 @@
IF (FONT_BACKEND STREQUAL "freetype")
FIND_PACKAGE(Freetype REQUIRED)
+ FIND_PACKAGE(HarfBuzz REQUIRED)
SET(WTF_USE_FREETYPE 1)
+ SET(WTF_USE_HARFBUZZ_NG 1)
ADD_DEFINITIONS(-DWTF_USE_FREETYPE=1)
+ ADD_DEFINITIONS(-DWTF_USE_HARFBUZZ_NG=1)
ELSE ()
FIND_PACKAGE(Pango REQUIRED)
SET(WTF_USE_PANGO 1)
Modified: trunk/Tools/ChangeLog (123863 => 123864)
--- trunk/Tools/ChangeLog 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Tools/ChangeLog 2012-07-27 11:32:44 UTC (rev 123864)
@@ -1,3 +1,15 @@
+2012-07-27 Dominik Röttsches <[email protected]>
+
+ [Cairo] Add complex font drawing using HarfbuzzNG
+ https://bugs.webkit.org/show_bug.cgi?id=91864
+
+ Reviewed by Simon Hausmann and Martin Robinson.
+
+ Bringing Harfbuzz support to EFL with this patch, so we need HarfBuzz in the pulled in jhbuild dependencies.
+
+ * WebKitTestRunner/CMakeLists.txt: Adding additional header include directories.
+ * efl/jhbuild.modules: Adding source for HarfBuzz release version 0.9.0.
+
2012-07-27 KwangYong Choi <[email protected]>
[WK2][EFL][WTR] TestNetscapePlugin is required.
Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (123863 => 123864)
--- trunk/Tools/WebKitTestRunner/CMakeLists.txt 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt 2012-07-27 11:32:44 UTC (rev 123864)
@@ -26,6 +26,8 @@
${WEBCORE_DIR}/editing
${WEBCORE_DIR}/platform
${WEBCORE_DIR}/platform/graphics
+ ${WEBCORE_DIR}/platform/graphics/harfbuzz
+ ${WEBCORE_DIR}/platform/graphics/harfbuzz/ng
${WEBCORE_DIR}/platform/network
${WEBCORE_DIR}/platform/text
${WEBCORE_DIR}/testing/js
Modified: trunk/Tools/efl/jhbuild.modules (123863 => 123864)
--- trunk/Tools/efl/jhbuild.modules 2012-07-27 11:12:56 UTC (rev 123863)
+++ trunk/Tools/efl/jhbuild.modules 2012-07-27 11:32:44 UTC (rev 123864)
@@ -9,6 +9,7 @@
<dep package="fonts"/>
<dep package="fontconfig"/>
<dep package="freetype6"/>
+ <dep package="harfbuzz"/>
<dep package="glib"/>
<dep package="glib-networking"/>
<dep package="libsoup"/>
@@ -160,6 +161,15 @@
</branch>
</autotools>
+ <autotools id="harfbuzz" autogen-sh="configure">
+ <branch module="software/harfbuzz/release/harfbuzz-20120627.tar.bz2" version="0.9.0"
+ checkoutdir="harfbuzz-0.9.0"
+ repo="freedesktop.org"
+ hash="sha256:562a187b84a2b5bd38f87e898f5f18aa918a41db62adbc17f6fcfd8fa1755485"
+ md5sum="18e6a8d847259441723a26e299792d55">
+ </branch>
+ </autotools>
+
<autotools id="eina" >
<branch module="eina"
repo="enlightenment.org"