Title: [122310] trunk/Source
Revision
122310
Author
[email protected]
Date
2012-07-11 00:46:52 -0700 (Wed, 11 Jul 2012)

Log Message

[Chromium] Adding HarfBuzz-ng for Linux
https://bugs.webkit.org/show_bug.cgi?id=90362

Reviewed by Tony Chang.

Source/WebCore:

This patch adds harfbuzz-ng support for Chromium Linux port as a part of
transition from old harfbuzz. HarfBuzzFaceSkia.cpp implements harfbuzz-ng
callbacks by using Skia APIs. For now, the feature is enabled only when
WTF_USE_HARFBUZZ_NG is defined.

No new tests. No change in behavior now.

* WebCore.gyp/WebCore.gyp: Added use_harfbuzz_ng variable and related files.
* WebCore.gypi: Added HarfBuzzFaceSkia.cpp
* platform/graphics/harfbuzz/FontHarfBuzz.cpp: Added USE(HARFBUZZ_NG).
(WebCore::Font::drawComplexText):
(WebCore::Font::floatWidthForComplexText):
(WebCore::Font::offsetForPositionForComplexText):
(WebCore::Font::selectionRectForComplexText):
* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: Ditto.
(WebCore):
(WebCore::FontPlatformData::harfbuzzFace):
* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h: Ditto.
(FontPlatformData):
* platform/graphics/harfbuzz/ng/HarfBuzzFaceSkia.cpp: Added.
(WebCore):
(WebCore::SkiaScalarToHarfbuzzPosition):
(WebCore::SkiaGetGlyphWidthAndExtents):
(WebCore::harfbuzzGetGlyph):
(WebCore::harfbuzzGetGlyphHorizontalAdvance):
(WebCore::harfbuzzGetGlyphHorizontalOrigin):
(WebCore::harfbuzzGetGlyphExtents):
(WebCore::harfbuzzSkiaGetFontFuncs):
(WebCore::harfbuzzSkiaGetTable):
(WebCore::destroyPaint):
(WebCore::HarfBuzzFace::createFace):
(WebCore::HarfBuzzFace::createFont):
(WebCore::HarfBuzzShaper::createGlyphBufferAdvance):
* platform/graphics/skia/GlyphPageTreeNodeSkia.cpp: Added USE(HARFBUZZ_NG).
(WebCore::substituteWithVerticalGlyphs):

Source/WebKit/chromium:

* features.gypi: Added use_harfbuzz_ng variable. If the value is set, USE(HARFBUZZ_NG) is defined.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122309 => 122310)


--- trunk/Source/WebCore/ChangeLog	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebCore/ChangeLog	2012-07-11 07:46:52 UTC (rev 122310)
@@ -1,3 +1,46 @@
+2012-07-11  Kenichi Ishibashi  <[email protected]>
+
+        [Chromium] Adding HarfBuzz-ng for Linux
+        https://bugs.webkit.org/show_bug.cgi?id=90362
+
+        Reviewed by Tony Chang.
+
+        This patch adds harfbuzz-ng support for Chromium Linux port as a part of
+        transition from old harfbuzz. HarfBuzzFaceSkia.cpp implements harfbuzz-ng
+        callbacks by using Skia APIs. For now, the feature is enabled only when
+        WTF_USE_HARFBUZZ_NG is defined.
+
+        No new tests. No change in behavior now.
+
+        * WebCore.gyp/WebCore.gyp: Added use_harfbuzz_ng variable and related files.
+        * WebCore.gypi: Added HarfBuzzFaceSkia.cpp
+        * platform/graphics/harfbuzz/FontHarfBuzz.cpp: Added USE(HARFBUZZ_NG).
+        (WebCore::Font::drawComplexText):
+        (WebCore::Font::floatWidthForComplexText):
+        (WebCore::Font::offsetForPositionForComplexText):
+        (WebCore::Font::selectionRectForComplexText):
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: Ditto.
+        (WebCore):
+        (WebCore::FontPlatformData::harfbuzzFace):
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h: Ditto.
+        (FontPlatformData):
+        * platform/graphics/harfbuzz/ng/HarfBuzzFaceSkia.cpp: Added.
+        (WebCore):
+        (WebCore::SkiaScalarToHarfbuzzPosition):
+        (WebCore::SkiaGetGlyphWidthAndExtents):
+        (WebCore::harfbuzzGetGlyph):
+        (WebCore::harfbuzzGetGlyphHorizontalAdvance):
+        (WebCore::harfbuzzGetGlyphHorizontalOrigin):
+        (WebCore::harfbuzzGetGlyphExtents):
+        (WebCore::harfbuzzSkiaGetFontFuncs):
+        (WebCore::harfbuzzSkiaGetTable):
+        (WebCore::destroyPaint):
+        (WebCore::HarfBuzzFace::createFace):
+        (WebCore::HarfBuzzFace::createFont):
+        (WebCore::HarfBuzzShaper::createGlyphBufferAdvance):
+        * platform/graphics/skia/GlyphPageTreeNodeSkia.cpp: Added USE(HARFBUZZ_NG).
+        (WebCore::substituteWithVerticalGlyphs):
+
 2012-07-11  Kenneth Russell  <[email protected]>
 
         compositing/webgl/webgl-nonpremultiplied-blend.html is flaky on Lion

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (122309 => 122310)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-07-11 07:46:52 UTC (rev 122310)
@@ -48,6 +48,8 @@
 
     'enable_wexit_time_destructors': 1,
 
+    'use_harfbuzz_ng%': 0,
+
     'webcore_include_dirs': [
       '../',
       '../..',
@@ -231,6 +233,11 @@
           '../platform/graphics/harfbuzz',
         ],
       }],
+      ['use_x11==1 and use_harfbuzz_ng==1', {
+        'webcore_include_dirs': [
+          '../platform/graphics/harfbuzz/ng',
+        ],
+      }],
       ['OS=="win" and buildtype=="Official"', {
         # On windows official release builds, we try to preserve symbol space.
         'derived_sources_aggregate_files': [
@@ -1566,6 +1573,16 @@
             ['exclude', 'Harfbuzz[^/]+\\.(cpp|h)$'],
           ],
         }],
+        ['use_x11==1 and use_harfbuzz_ng==1', {
+          'sources/': [
+            ['exclude', 'platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz\\.cpp$'],
+            ['exclude', 'platform/graphics/harfbuzz/HarfBuzzSkia\\.cpp$'],
+
+            ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzFace\\.(cpp|h)$'],
+            ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzFaceSkia\\.cpp$'],
+            ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzShaper\\.(cpp|h)$'],
+          ],
+        }],
         ['toolkit_uses_gtk == 1', {
           'sources/': [
             # Cherry-pick files excluded by the broader regular expressions above.

Modified: trunk/Source/WebCore/WebCore.gypi (122309 => 122310)


--- trunk/Source/WebCore/WebCore.gypi	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebCore/WebCore.gypi	2012-07-11 07:46:52 UTC (rev 122310)
@@ -3771,6 +3771,7 @@
             'platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp',
             'platform/graphics/harfbuzz/HarfBuzzShaperBase.h',
             'platform/graphics/harfbuzz/ng/HarfBuzzFaceCoreText.cpp',
+            'platform/graphics/harfbuzz/ng/HarfBuzzFaceSkia.cpp',
             'platform/graphics/harfbuzz/ng/HarfBuzzFace.cpp',
             'platform/graphics/harfbuzz/ng/HarfBuzzFace.h',
             'platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp',

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp (122309 => 122310)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp	2012-07-11 07:46:52 UTC (rev 122310)
@@ -31,11 +31,16 @@
 #include "config.h"
 #include "Font.h"
 
+#if USE(HARFBUZZ_NG)
+#include "HarfBuzzShaper.h"
+#else
 #include "ComplexTextControllerHarfBuzz.h"
+#include "HarfBuzzSkia.h"
+#endif
+
 #include "FloatRect.h"
 #include "GlyphBuffer.h"
 #include "GraphicsContext.h"
-#include "HarfBuzzSkia.h"
 #include "NotImplemented.h"
 #include "PlatformContextSkia.h"
 #include "SimpleFontData.h"
@@ -158,7 +163,6 @@
     if (!run.length())
         return;
 
-    SkCanvas* canvas = gc->platformContext()->canvas();
     TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode();
     bool fill = textMode & TextModeFill;
     bool stroke = (textMode & TextModeStroke)
@@ -178,6 +182,14 @@
         setupForTextPainting(&strokePaint, gc->strokeColor().rgb());
     }
 
+#if USE(HARFBUZZ_NG)
+    GlyphBuffer glyphBuffer;
+    HarfBuzzShaper shaper(this, run);
+    if (!shaper.shape(&glyphBuffer))
+        return;
+    drawGlyphBuffer(gc, run, glyphBuffer, point);
+#else
+    SkCanvas* canvas = gc->platformContext()->canvas();
     ComplexTextController controller(this, run, point.x(), point.y());
     if (run.rtl())
         controller.setupForRTL();
@@ -201,6 +213,7 @@
             canvas->drawPosText(controller.glyphs() + fromGlyph, glyphLength << 1, controller.positions() + fromGlyph, strokePaint);
         }
     }
+#endif
 }
 
 void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
@@ -210,8 +223,15 @@
 
 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const
 {
+#if USE(HARFBUZZ_NG)
+    HarfBuzzShaper shaper(this, run);
+    if (!shaper.shape())
+        return 0;
+    return shaper.totalWidth();
+#else
     ComplexTextController controller(this, run, 0, 0);
     return controller.widthOfFullRun();
+#endif
 }
 
 // Return the code point index for the given |x| offset into the text run.
@@ -222,12 +242,19 @@
     // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
     int targetX = static_cast<int>(xFloat);
 
+#if USE(HARFBUZZ_NG)
+    HarfBuzzShaper shaper(this, run);
+    if (!shaper.shape())
+        return 0;
+    return shaper.offsetForPosition(targetX);
+#else
     // (Mac code ignores includePartialGlyphs, and they don't know what it's
     // supposed to do, so we just ignore it as well.)
     ComplexTextController controller(this, run, 0, 0);
     if (run.rtl())
         controller.setupForRTL();
     return controller.offsetForPosition(targetX);
+#endif
 }
 
 // Return the rectangle for selecting the given range of code-points in the TextRun.
@@ -235,10 +262,17 @@
                                             const FloatPoint& point, int height,
                                             int from, int to) const
 {
+#if USE(HARFBUZZ_NG)
+    HarfBuzzShaper shaper(this, run);
+    if (!shaper.shape())
+        return FloatRect();
+    return shaper.selectionRect(point, height, from, to);
+#else
     ComplexTextController controller(this, run, 0, 0);
     if (run.rtl())
         controller.setupForRTL();
     return controller.selectionRect(point, height, from, to);
+#endif
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp (122309 => 122310)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-07-11 07:46:52 UTC (rev 122310)
@@ -251,6 +251,15 @@
     return false;
 }
 
+#if USE(HARFBUZZ_NG)
+HarfBuzzFace* FontPlatformData::harfbuzzFace() const
+{
+    if (!m_harfbuzzFace)
+        m_harfbuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this), uniqueID());
+
+    return m_harfbuzzFace.get();
+}
+#else
 HarfbuzzFace* FontPlatformData::harfbuzzFace() const
 {
     if (!m_harfbuzzFace)
@@ -258,6 +267,7 @@
 
     return m_harfbuzzFace.get();
 }
+#endif
 
 void FontPlatformData::querySystemForRenderStyle()
 {

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h (122309 => 122310)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h	2012-07-11 07:46:52 UTC (rev 122310)
@@ -33,7 +33,11 @@
 
 #include "FontOrientation.h"
 #include "FontRenderStyle.h"
+#if USE(HARFBUZZ_NG)
+#include "HarfBuzzFace.h"
+#else
 #include "HarfBuzzSkia.h"
+#endif
 #include "SkPaint.h"
 #include "TextOrientation.h"
 #include <wtf/Forward.h>
@@ -128,7 +132,12 @@
     String description() const;
 #endif
 
+#if USE(HARFBUZZ_NG)
+    // FIXME: Rename this like "harfbuzzNGFace()" because difference is too subtle.
+    HarfBuzzFace* harfbuzzFace() const;
+#else
     HarfbuzzFace* harfbuzzFace() const;
+#endif
 
     // -------------------------------------------------------------------------
     // Global font preferences...
@@ -153,7 +162,11 @@
     FontOrientation m_orientation;
     TextOrientation m_textOrientation;
     FontRenderStyle m_style;
+#if USE(HARFBUZZ_NG)
+    mutable RefPtr<HarfBuzzFace> m_harfbuzzFace;
+#else
     mutable RefPtr<HarfbuzzFace> m_harfbuzzFace;
+#endif
 
     SkTypeface* hashTableDeletedFontValue() const { return reinterpret_cast<SkTypeface*>(-1); }
 };

Added: trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzFaceSkia.cpp (0 => 122310)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzFaceSkia.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzFaceSkia.cpp	2012-07-11 07:46:52 UTC (rev 122310)
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2012 Google 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:
+ *
+ *     * 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 "HarfBuzzFace.h"
+
+#include "FontPlatformData.h"
+#include "GlyphBuffer.h"
+#include "HarfBuzzShaper.h"
+#include "SimpleFontData.h"
+#include "SkFontHost.h"
+#include "SkPaint.h"
+#include "SkPath.h"
+#include "SkPoint.h"
+#include "SkRect.h"
+#include "SkUtils.h"
+
+#include "hb.h"
+
+namespace WebCore {
+
+// Our implementation of the callbacks which Harfbuzz requires by using Skia
+// calls. See the Harfbuzz source for references about what these callbacks do.
+
+static hb_position_t SkiaScalarToHarfbuzzPosition(SkScalar value)
+{
+    return SkScalarToFixed(value);
+}
+
+static void SkiaGetGlyphWidthAndExtents(SkPaint* paint, hb_codepoint_t codepoint, hb_position_t* width, hb_glyph_extents_t* extents)
+{
+    if (codepoint > 0xFFFF)
+        return;
+    paint->setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+
+    SkScalar skWidth;
+    SkRect skBounds;
+    uint16_t glyph = codepoint;
+
+    paint->getTextWidths(&glyph, sizeof(glyph), &skWidth, &skBounds);
+    if (width)
+        *width = SkiaScalarToHarfbuzzPosition(skWidth);
+    if (extents) {
+        extents->x_bearing = SkiaScalarToHarfbuzzPosition(skBounds.fLeft);
+        // The extents are unused in harfbuzz now so we're unsure whether a negation is needed here. Revisit when we're sure.
+        extents->y_bearing = SkiaScalarToHarfbuzzPosition(skBounds.fTop);
+        extents->width = SkiaScalarToHarfbuzzPosition(skBounds.width());
+        extents->height = SkiaScalarToHarfbuzzPosition(skBounds.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)
+{
+    SkPaint* paint = reinterpret_cast<SkPaint*>(fontData);
+
+    paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
+    uint16_t text[4];
+    size_t length = SkUTF16_FromUnichar(unicode, text);
+    uint16_t glyph16;
+    paint->textToGlyphs(text, length, &glyph16);
+    *glyph = glyph16;
+    return !!*glyph;
+}
+
+static hb_position_t harfbuzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, void* userData)
+{
+    SkPaint* paint = reinterpret_cast<SkPaint*>(fontData);
+    hb_position_t advance = 0;
+
+    SkiaGetGlyphWidthAndExtents(paint, 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)
+{
+    SkPaint* paint = reinterpret_cast<SkPaint*>(fontData);
+
+    SkiaGetGlyphWidthAndExtents(paint, glyph, 0, extents);
+    return true;
+}
+
+static hb_font_funcs_t* harfbuzzSkiaGetFontFuncs()
+{
+    static hb_font_funcs_t* harfbuzzSkiaFontFuncs = 0;
+
+    // We don't set callback functions which we can't support.
+    // Harfbuzz will use the fallback implementation if they aren't set.
+    if (!harfbuzzSkiaFontFuncs) {
+        harfbuzzSkiaFontFuncs = hb_font_funcs_create();
+        hb_font_funcs_set_glyph_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyph, 0, 0);
+        hb_font_funcs_set_glyph_h_advance_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyphHorizontalAdvance, 0, 0);
+        hb_font_funcs_set_glyph_h_origin_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyphHorizontalOrigin, 0, 0);
+        hb_font_funcs_set_glyph_extents_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyphExtents, 0, 0);
+        hb_font_funcs_make_immutable(harfbuzzSkiaFontFuncs);
+    }
+    return harfbuzzSkiaFontFuncs;
+}
+
+static hb_blob_t* harfbuzzSkiaGetTable(hb_face_t* face, hb_tag_t tag, void* userData)
+{
+    FontPlatformData* font = reinterpret_cast<FontPlatformData*>(userData);
+
+    const size_t tableSize = SkFontHost::GetTableSize(font->uniqueID(), tag);
+    if (!tableSize)
+        return 0;
+
+    char* buffer = reinterpret_cast<char*>(fastMalloc(tableSize));
+    if (!buffer)
+        return 0;
+    size_t actualSize = SkFontHost::GetTableData(font->uniqueID(), tag, 0, tableSize, buffer);
+    if (tableSize != actualSize) {
+        fastFree(buffer);
+        return 0;
+    }
+
+    return hb_blob_create(const_cast<char*>(buffer), tableSize,
+                          HB_MEMORY_MODE_WRITABLE, buffer, fastFree);
+}
+
+static void destroyPaint(void* userData)
+{
+    SkPaint* paint = reinterpret_cast<SkPaint*>(userData);
+    delete paint;
+}
+
+hb_face_t* HarfBuzzFace::createFace()
+{
+    hb_face_t* face = hb_face_create_for_tables(harfbuzzSkiaGetTable, m_platformData, 0);
+    ASSERT(face);
+    return face;
+}
+
+hb_font_t* HarfBuzzFace::createFont()
+{
+    hb_font_t* font = hb_font_create(m_face);
+    SkPaint* paint = new SkPaint;
+    m_platformData->setupPaint(paint);
+    hb_font_set_funcs(font, harfbuzzSkiaGetFontFuncs(), paint, destroyPaint);
+    float size = m_platformData->size();
+    if (floorf(size) == size)
+        hb_font_set_ppem(font, size, size);
+    int scale = SkiaScalarToHarfbuzzPosition(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/WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp (122309 => 122310)


--- trunk/Source/WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp	2012-07-11 07:46:52 UTC (rev 122310)
@@ -32,21 +32,31 @@
 #include "GlyphPageTreeNode.h"
 
 #include "Font.h"
+#if !USE(HARFBUZZ_NG)
 #include "HarfBuzzSkia.h"
+#else
+#include "NotImplemented.h"
+#endif
 #include "SimpleFontData.h"
 
 #include "SkTemplates.h"
 #include "SkPaint.h"
 #include "SkUtils.h"
 
+#if !USE(HARFBUZZ_NG)
 extern "C" {
 #include "harfbuzz-shaper.h"
 }
+#endif
 
 namespace WebCore {
 
 static int substituteWithVerticalGlyphs(const SimpleFontData* fontData, uint16_t* glyphs, unsigned bufferLength)
 {
+#if USE(HARFBUZZ_NG)
+    notImplemented();
+    return 0xFFFF;
+#else
     HB_FaceRec_* hbFace = fontData->platformData().harfbuzzFace()->face();
     if (!hbFace->gsub) {
         // if there is no GSUB table, treat it as not covered
@@ -73,6 +83,7 @@
             glyphs[i] = static_cast<Glyph>(buffer->out_string[i].gindex);
     }
     return error;
+#endif
 }
 
 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)

Modified: trunk/Source/WebKit/chromium/ChangeLog (122309 => 122310)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-11 07:46:52 UTC (rev 122310)
@@ -1,3 +1,12 @@
+2012-07-11  Kenichi Ishibashi  <[email protected]>
+
+        [Chromium] Adding HarfBuzz-ng for Linux
+        https://bugs.webkit.org/show_bug.cgi?id=90362
+
+        Reviewed by Tony Chang.
+
+        * features.gypi: Added use_harfbuzz_ng variable. If the value is set, USE(HARFBUZZ_NG) is defined.
+
 2012-07-10  Hayato Ito  <[email protected]>
 
         Unreviewed gardening.

Modified: trunk/Source/WebKit/chromium/features.gypi (122309 => 122310)


--- trunk/Source/WebKit/chromium/features.gypi	2012-07-11 07:42:07 UTC (rev 122309)
+++ trunk/Source/WebKit/chromium/features.gypi	2012-07-11 07:46:52 UTC (rev 122310)
@@ -129,6 +129,7 @@
       'enable_touch_events%': 1,
       'enable_touch_icon_loading%' : 0,
       'enable_mutation_observers%': 1,
+      'use_harfbuzz_ng%': 0,
     },
     'use_accelerated_compositing%': '<(use_accelerated_compositing)',
     'enable_skia_text%': '<(enable_skia_text)',
@@ -206,6 +207,11 @@
           'WTF_USE_SKIA_ON_MAC_CHROMIUM=1',
         ],
       }],
+      ['use_harfbuzz_ng==1', {
+        'feature_defines': [
+          'WTF_USE_HARFBUZZ_NG=1',
+        ],
+      }],
     ],
   },
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to