⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 131365 in webkit


Ignore:
Timestamp:
Oct 15, 2012, 2:50:53 PM (14 years ago)
Author:
mitz@apple.com
Message:

Source/WebCore: WebCore part of <rdar://problem/12470680> Font’s fast code path doesn’t support kerning and ligatures
https://bugs.webkit.org/show_bug.cgi?id=99113

Reviewed by Tim Horton.

  • WebCore.exp.in: Exported wkCTFontTransformGlyphs.
  • platform/graphics/Font.cpp:

(WebCore::Font::width): Added a local GlyphBuffer to pass to floatWidthForSimpleText().
(WebCore::Font::codePath): Rather than always use the complex code path when any typesetting
features are enabled, changed to do so only if WidthIterator doesn’t support this Font’s
typesetting features.

  • platform/graphics/FontFastPath.cpp:

(WebCore::Font::getGlyphsAndAdvancesForSimpleText): Added a local GlyphBuffer to pass to
WidthIterator::advance() when advancing to or from the range of interest. Added a FIXME
about how this is not entirely correct when kerning or ligatures are enabled.
(WebCore::Font::selectionRectForSimpleText): Added a local GlyphBuffer to pass to
WidthIterator::advance() when advancing to or from the range of interest.
(WebCore::Font::offsetForPositionForSimpleText): Updated for the change to
WidthIterator::advanceOneCharacter().

  • platform/graphics/SimpleFontData.h:

(WebCore::SimpleFontData::applyTransforms): Added. Calls wkCTFontTransformGlyphs() where
available.

  • platform/graphics/WidthIterator.cpp:

(WebCore::WidthIterator::WidthIterator): Added initializer for the new m_typesettingFeatures
data member.
(OriginalAdvancesForCharacterTreatedAsSpace): Added this data type, used to track spaces and
characters treated as spaces.
(WebCore::applyFontTransforms): Added. Applies shaping and positioning transforms, as
required by the typesetting features, to the glyphs recently added to a GlyphBuffer, while
maintaining the advances of characters that are treated as spaces and the characters
preceding them, if necessary.
(WebCore::WidthIterator::advanceInternal): Added calls to applyFontTransforms() at the end
of each contiguous run of glyphs from the same font. Also added code to maintain a vector
of spaces and characters treated as space.
(WebCore::WidthIterator::advanceOneCharacter): Changed the parameter type from a pointer to
a reference.

  • platform/graphics/WidthIterator.h:

(WebCore::WidthIterator::supportsTypesettingFeatures): Added. Returns whether WidthIterator
instances support the typesetting features of the given font. Returns true if the font is
not a screen font and its typesetting features are kerning, ligatures or both.
(WebCore::WidthIterator::shouldApplyFontTransforms): Added. Returns true if the typesetting
features include kerning or ligatures.

  • platform/mac/WebCoreSystemInterface.h: Defined wkCTFontTransformOptions and declared

wkCTFontTransformGlyphs.

  • platform/mac/WebCoreSystemInterface.mm: Defined wkCTFontTransformGlyphs.
  • rendering/svg/SVGTextMetricsBuilder.cpp:

(WebCore::SVGTextMetricsBuilder::advanceSimpleText): Added a local GlyphBuffer to pass to
WidthIterator::advance().

  • rendering/svg/SVGTextRunRenderingContext.cpp:

(WebCore::SVGTextRunRenderingContext::floatWidthUsingSVGFont): Ditto.

Source/WebKit/mac: WebKit/mac part of <rdar://problem/12470680> Font’s fast code path doesn’t support kerning and ligatures
https://bugs.webkit.org/show_bug.cgi?id=99113

Reviewed by Tim Horton.

  • WebCoreSupport/WebSystemInterface.mm:

(InitWebCoreSystemInterface): Added wkCTFontTransformGlyphs.

Source/WebKit2: WebKit2 part of <rdar://problem/12470680> Font’s fast code path doesn’t support kerning and ligatures
https://bugs.webkit.org/show_bug.cgi?id=99113

Reviewed by Tim Horton.

  • WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:

(InitWebCoreSystemInterface): Added wkCTFontTransformGlyphs.

Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r131363 r131365  
     12012-10-15  Dan Bernstein  <mitz@apple.com>
     2
     3        WebCore part of <rdar://problem/12470680> Font’s fast code path doesn’t support kerning and ligatures
     4        https://bugs.webkit.org/show_bug.cgi?id=99113
     5
     6        Reviewed by Tim Horton.
     7
     8        * WebCore.exp.in: Exported wkCTFontTransformGlyphs.
     9        * platform/graphics/Font.cpp:
     10        (WebCore::Font::width): Added a local GlyphBuffer to pass to floatWidthForSimpleText().
     11        (WebCore::Font::codePath): Rather than always use the complex code path when any typesetting
     12        features are enabled, changed to do so only if WidthIterator doesn’t support this Font’s
     13        typesetting features.
     14        * platform/graphics/FontFastPath.cpp:
     15        (WebCore::Font::getGlyphsAndAdvancesForSimpleText): Added a local GlyphBuffer to pass to
     16        WidthIterator::advance() when advancing to or from the range of interest. Added a FIXME
     17        about how this is not entirely correct when kerning or ligatures are enabled.
     18        (WebCore::Font::selectionRectForSimpleText): Added a local GlyphBuffer to pass to
     19        WidthIterator::advance() when advancing to or from the range of interest.
     20        (WebCore::Font::offsetForPositionForSimpleText): Updated for the change to
     21        WidthIterator::advanceOneCharacter().
     22        * platform/graphics/SimpleFontData.h:
     23        (WebCore::SimpleFontData::applyTransforms): Added. Calls wkCTFontTransformGlyphs() where
     24        available.
     25        * platform/graphics/WidthIterator.cpp:
     26        (WebCore::WidthIterator::WidthIterator): Added initializer for the new m_typesettingFeatures
     27        data member.
     28        (OriginalAdvancesForCharacterTreatedAsSpace): Added this data type, used to track spaces and
     29        characters treated as spaces.
     30        (WebCore::applyFontTransforms): Added. Applies shaping and positioning transforms, as
     31        required by the typesetting features, to the glyphs recently added to a GlyphBuffer, while
     32        maintaining the advances of characters that are treated as spaces and the characters
     33        preceding them, if necessary.
     34        (WebCore::WidthIterator::advanceInternal): Added calls to applyFontTransforms() at the end
     35        of each contiguous run of glyphs from the same font. Also added code to maintain a vector
     36        of spaces and characters treated as space.
     37        (WebCore::WidthIterator::advanceOneCharacter): Changed the parameter type from a pointer to
     38        a reference.
     39        * platform/graphics/WidthIterator.h:
     40        (WebCore::WidthIterator::supportsTypesettingFeatures): Added. Returns whether WidthIterator
     41        instances support the typesetting features of the given font. Returns true if the font is
     42        not a screen font and its typesetting features are kerning, ligatures or both.
     43        (WebCore::WidthIterator::shouldApplyFontTransforms): Added. Returns true if the typesetting
     44        features include kerning or ligatures.
     45        * platform/mac/WebCoreSystemInterface.h: Defined wkCTFontTransformOptions and declared
     46        wkCTFontTransformGlyphs.
     47        * platform/mac/WebCoreSystemInterface.mm: Defined wkCTFontTransformGlyphs.
     48        * rendering/svg/SVGTextMetricsBuilder.cpp:
     49        (WebCore::SVGTextMetricsBuilder::advanceSimpleText): Added a local GlyphBuffer to pass to
     50        WidthIterator::advance().
     51        * rendering/svg/SVGTextRunRenderingContext.cpp:
     52        (WebCore::SVGTextRunRenderingContext::floatWidthUsingSVGFont): Ditto.
     53
    1542012-10-15  Mark Lam  <mark.lam@apple.com>
    255
  • trunk/Source/WebCore/WebCore.exp.in

    r131275 r131365  
    14581458#endif
    14591459_wkCGPatternCreateWithImageAndTransform
     1460#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     1461_wkCTFontTransformGlyphs
     1462#endif
    14601463_wkCopyCFLocalizationPreferredName
    14611464_wkCopyCFURLResponseSuggestedFilename
  • trunk/Source/WebCore/platform/graphics/Font.cpp

    r130851 r131365  
    188188        // returning them for simple text as well.
    189189        static bool returnFallbackFonts = canReturnFallbackFontsForComplexText();
    190         return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow || (glyphOverflow && glyphOverflow->computeBounds) ? glyphOverflow : 0);
     190        GlyphBuffer glyphBuffer;
     191        return floatWidthForSimpleText(run, &glyphBuffer, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow || (glyphOverflow && glyphOverflow->computeBounds) ? glyphOverflow : 0);
    191192    }
    192193
     
    315316        return Complex;
    316317   
    317     if (run.length() > 1 && typesettingFeatures())
     318    if (run.length() > 1 && !WidthIterator::supportsTypesettingFeatures(*this))
    318319        return Complex;
    319320
  • trunk/Source/WebCore/platform/graphics/FontFastPath.cpp

    r131311 r131365  
    329329
    330330    WidthIterator it(this, run, 0, false, forTextEmphasis);
    331     it.advance(from);
     331    // FIXME: Using separate glyph buffers for the prefix and the suffix is incorrect when kerning or
     332    // ligatures are enabled.
     333    GlyphBuffer localGlyphBuffer;
     334    it.advance(from, &localGlyphBuffer);
    332335    float beforeWidth = it.m_runWidthSoFar;
    333336    it.advance(to, &glyphBuffer);
     
    340343    if (run.rtl()) {
    341344        float finalRoundingWidth = it.m_finalRoundingWidth;
    342         it.advance(run.length());
     345        it.advance(run.length(), &localGlyphBuffer);
    343346        initialAdvance = finalRoundingWidth + it.m_runWidthSoFar - afterWidth;
    344347    } else
     
    484487FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
    485488{
     489    GlyphBuffer glyphBuffer;
    486490    WidthIterator it(this, run);
    487     it.advance(from);
     491    it.advance(from, &glyphBuffer);
    488492    float beforeWidth = it.m_runWidthSoFar;
    489     it.advance(to);
     493    it.advance(to, &glyphBuffer);
    490494    float afterWidth = it.m_runWidthSoFar;
    491495
    492496    // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning.
    493497    if (run.rtl()) {
    494         it.advance(run.length());
     498        it.advance(run.length(), &glyphBuffer);
    495499        float totalWidth = it.m_runWidthSoFar;
    496500        return FloatRect(floorf(point.x() + totalWidth - afterWidth), point.y(), roundf(point.x() + totalWidth - beforeWidth) - floorf(point.x() + totalWidth - afterWidth), h);
     
    512516            offset = it.m_currentCharacter;
    513517            float w;
    514             if (!it.advanceOneCharacter(w, &localGlyphBuffer))
     518            if (!it.advanceOneCharacter(w, localGlyphBuffer))
    515519                break;
    516520            delta += w;
     
    527531            offset = it.m_currentCharacter;
    528532            float w;
    529             if (!it.advanceOneCharacter(w, &localGlyphBuffer))
     533            if (!it.advanceOneCharacter(w, localGlyphBuffer))
    530534                break;
    531535            delta -= w;
  • trunk/Source/WebCore/platform/graphics/GlyphBuffer.h

    r120122 r131365  
    6464// can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm
    6565#if USE(CG) || (OS(DARWIN) && (PLATFORM(WX) || PLATFORM(CHROMIUM)))
    66 typedef CGSize GlyphBufferAdvance;
     66struct GlyphBufferAdvance : CGSize {
     67public:
     68    GlyphBufferAdvance(CGSize size) : CGSize(size)
     69    {
     70    }
     71
     72    void setWidth(CGFloat width) { this->CGSize::width = width; }
     73    CGFloat width() const { return this->CGSize::width; }
     74};
    6775#elif OS(WINCE)
    6876// There is no cross-platform code that uses the height of GlyphBufferAdvance,
    6977// so we can save memory space on embedded devices by storing only the width
    70 typedef float GlyphBufferAdvance;
     78struct GlyphBufferAdvance {
     79public:
     80    GlyphBufferAdvance(float width)
     81        : advance(width)
     82    {
     83    }
     84
     85    void setWidth(float width) { advance = width; }
     86    float& width() { return advance; }
     87    const float& width() const { return advance; }
     88
     89private:
     90    float advance;
     91};
    7192#else
    7293typedef FloatSize GlyphBufferAdvance;
     
    127148    float advanceAt(int index) const
    128149    {
    129 #if USE(CG) || (OS(DARWIN) && (PLATFORM(WX) || PLATFORM(CHROMIUM)))
    130         return m_advances[index].width;
    131 #elif OS(WINCE)
    132         return m_advances[index];
    133 #else
    134150        return m_advances[index].width();
    135 #endif
    136151    }
    137152
     
    197212        ASSERT(!isEmpty());
    198213        GlyphBufferAdvance& lastAdvance = m_advances.last();
    199 #if USE(CG) || (OS(DARWIN) && (PLATFORM(WX) || PLATFORM(CHROMIUM)))
    200         lastAdvance.width += width;
    201 #elif OS(WINCE)
    202         lastAdvance += width;
    203 #else
    204         lastAdvance += FloatSize(width, 0);
    205 #endif
     214        lastAdvance.setWidth(lastAdvance.width() + width);
    206215    }
    207216
  • trunk/Source/WebCore/platform/graphics/SimpleFontData.h

    r130231 r131365  
    3030#include "FontPlatformData.h"
    3131#include "FloatRect.h"
     32#include "GlyphBuffer.h"
    3233#include "GlyphMetricsMap.h"
    3334#include "GlyphPageTreeNode.h"
     
    3839#include <wtf/OwnPtr.h>
    3940#include <wtf/PassOwnPtr.h>
     41#include <wtf/UnusedParam.h>
    4042#include <wtf/text/StringHash.h>
     43
     44#if PLATFORM(MAC)
     45#include "WebCoreSystemInterface.h"
     46#endif
    4147
    4248#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN))
     
    191197#endif
    192198
     199    bool applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const
     200    {
     201#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
     202        UNUSED_PARAM(glyphs);
     203        UNUSED_PARAM(advances);
     204        UNUSED_PARAM(glyphCount);
     205        UNUSED_PARAM(typesettingFeatures);
     206        ASSERT_NOT_REACHED();
     207        return false;
     208#else
     209    wkCTFontTransformOptions options = (typesettingFeatures & Kerning ? wkCTFontTransformApplyPositioning : 0) | (typesettingFeatures & Ligatures ? wkCTFontTransformApplyShaping : 0);
     210    return wkCTFontTransformGlyphs(m_platformData.ctFont(), glyphs, reinterpret_cast<CGSize*>(advances), glyphCount, options);
     211#endif
     212    }
     213
    193214#if PLATFORM(QT)
    194215    QRawFont getQtRawFont() const { return m_platformData.rawFont(); }
  • trunk/Source/WebCore/platform/graphics/WidthIterator.cpp

    r128692 r131365  
    4444    , m_isAfterExpansion(!run.allowsLeadingExpansion())
    4545    , m_finalRoundingWidth(0)
     46    , m_typesettingFeatures(font->typesettingFeatures())
    4647    , m_fallbackFonts(fallbackFonts)
    4748    , m_accountForGlyphBounds(accountForGlyphBounds)
     
    8586}
    8687
     88struct OriginalAdvancesForCharacterTreatedAsSpace {
     89public:
     90    OriginalAdvancesForCharacterTreatedAsSpace(bool isSpace, float advanceBefore, float advanceAt)
     91        : characterIsSpace(isSpace)
     92        , advanceBeforeCharacter(advanceBefore)
     93        , advanceAtCharacter(advanceAt)
     94    {
     95    }
     96
     97    bool characterIsSpace;
     98    float advanceBeforeCharacter;
     99    float advanceAtCharacter;
     100};
     101
     102typedef Vector<pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
     103
     104static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace)
     105{
     106    ASSERT(typesettingFeatures & (Kerning | Ligatures));
     107
     108    if (!glyphBuffer)
     109        return 0;
     110
     111    int glyphBufferSize = glyphBuffer->size();
     112    if (glyphBuffer->size() <= lastGlyphCount)
     113        return 0;
     114
     115    GlyphBufferAdvance* advances = glyphBuffer->advances(0);
     116    float widthDifference = 0;
     117    for (int i = lastGlyphCount; i < glyphBufferSize; ++i)
     118        widthDifference -= advances[i].width();
     119
     120    if (!ltr) {
     121        for (int i = 0, end = glyphBuffer->size() - 1; i < glyphBuffer->size() / 2; ++i, --end)
     122            glyphBuffer->swap(i, end);
     123    }
     124
     125    fontData->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures);
     126
     127    if (!ltr) {
     128        for (int i = 0, end = glyphBuffer->size() - 1; i < glyphBuffer->size() / 2; ++i, --end)
     129            glyphBuffer->swap(i, end);
     130    }
     131
     132    for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) {
     133        int spaceOffset = charactersTreatedAsSpace[i].first;
     134        const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = charactersTreatedAsSpace[i].second;
     135        if (spaceOffset && !originalAdvances.characterIsSpace)
     136            glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.advanceBeforeCharacter);
     137        glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtCharacter);
     138    }
     139    charactersTreatedAsSpace.clear();
     140
     141    for (int i = lastGlyphCount; i < glyphBufferSize; ++i)
     142        widthDifference += advances[i].width();
     143
     144    lastGlyphCount = glyphBufferSize;
     145    return widthDifference;
     146}
     147
    87148template <typename TextIterator>
    88149inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, GlyphBuffer* glyphBuffer)
     
    100161    const SimpleFontData* primaryFont = m_font->primaryFont();
    101162    const SimpleFontData* lastFontData = primaryFont;
     163    int lastGlyphCount = glyphBuffer ? glyphBuffer->size() : 0;
    102164
    103165    UChar32 character = 0;
    104166    unsigned clusterLength = 0;
    105 
     167    CharactersTreatedAsSpace charactersTreatedAsSpace;
    106168    while (textIterator.consume(character, clusterLength)) {
    107169        unsigned advanceLength = clusterLength;
     
    133195
    134196        if (fontData != lastFontData && width) {
     197            if (shouldApplyFontTransforms())
     198                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, charactersTreatedAsSpace);
     199
    135200            lastFontData = fontData;
    136201            if (m_fallbackFonts && fontData != primaryFont) {
     
    188253        }
    189254
     255        if (shouldApplyFontTransforms() && glyphBuffer && Font::treatAsSpace(character))
     256            charactersTreatedAsSpace.append(make_pair(glyphBuffer->size(),
     257                OriginalAdvancesForCharacterTreatedAsSpace(character == ' ', glyphBuffer->size() ? glyphBuffer->advanceAt(glyphBuffer->size() - 1) : 0, width)));
     258
    190259        if (m_accountForGlyphBounds) {
    191260            bounds = fontData->boundsForGlyph(glyph);
     
    240309    }
    241310
     311    if (shouldApplyFontTransforms())
     312        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, charactersTreatedAsSpace);
     313
    242314    unsigned consumedCharacters = textIterator.currentCharacter() - m_currentCharacter;
    243315    m_currentCharacter = textIterator.currentCharacter();
     
    266338}
    267339
    268 bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer)
    269 {
    270     int oldSize = glyphBuffer->size();
    271     advance(m_currentCharacter + 1, glyphBuffer);
     340bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer& glyphBuffer)
     341{
     342    int oldSize = glyphBuffer.size();
     343    advance(m_currentCharacter + 1, &glyphBuffer);
    272344    float w = 0;
    273     for (int i = oldSize; i < glyphBuffer->size(); ++i)
    274         w += glyphBuffer->advanceAt(i);
     345    for (int i = oldSize; i < glyphBuffer.size(); ++i)
     346        w += glyphBuffer.advanceAt(i);
    275347    width = w;
    276     return glyphBuffer->size() > oldSize;
    277 }
    278 
    279 }
     348    return glyphBuffer.size() > oldSize;
     349}
     350
     351}
  • trunk/Source/WebCore/platform/graphics/WidthIterator.h

    r128572 r131365  
    2323#define WidthIterator_h
    2424
     25#include "Font.h"
    2526#include "SVGGlyph.h"
    2627#include <wtf/HashSet.h>
     
    4142    WidthIterator(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false);
    4243
    43     unsigned advance(int to, GlyphBuffer* = 0);
    44     bool advanceOneCharacter(float& width, GlyphBuffer* = 0);
     44    unsigned advance(int to, GlyphBuffer*);
     45    bool advanceOneCharacter(float& width, GlyphBuffer&);
    4546
    4647    float maxGlyphBoundingBoxY() const { ASSERT(m_accountForGlyphBounds); return m_maxGlyphBoundingBoxY; }
     
    5758    Vector<SVGGlyph::ArabicForm>& arabicForms() { return m_arabicForms; }
    5859#endif
     60
     61    static bool supportsTypesettingFeatures(const Font& font)
     62    {
     63#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
     64        return !font.typesettingFeatures();
     65#else
     66        if (!font.isPrinterFont())
     67            return !font.typesettingFeatures();
     68
     69        return !(font.typesettingFeatures() & ~(Kerning | Ligatures));
     70#endif
     71    }
    5972
    6073    const Font* m_font;
     
    7992    inline unsigned advanceInternal(TextIterator&, GlyphBuffer*);
    8093
     94    bool shouldApplyFontTransforms() const { return m_typesettingFeatures & (Kerning | Ligatures); }
     95
     96    TypesettingFeatures m_typesettingFeatures;
    8197    HashSet<const SimpleFontData*>* m_fallbackFonts;
    8298    bool m_accountForGlyphBounds;
  • trunk/Source/WebCore/platform/graphics/mac/FontMac.mm

    r122670 r131365  
    242242        // If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative.
    243243        float shadowTextY = point.y() + shadowOffset.height() * (context->shadowsIgnoreTransforms() ? -1 : 1);
    244         showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     244        showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    245245        if (syntheticBoldOffset)
    246             showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     246            showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    247247        context->setFillColor(fillColor, fillColorSpace);
    248248    }
    249249
    250     showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     250    showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    251251    if (syntheticBoldOffset)
    252         showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     252        showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    253253
    254254    if (hasSimpleShadow)
  • trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp

    r126666 r131365  
    198198        float shadowTextY = point.y() + translation.height() + shadowOffset.height() * (graphicsContext->shadowsIgnoreTransforms() ? -1 : 1);
    199199        CGContextSetTextPosition(cgContext, shadowTextX, shadowTextY);
    200         CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     200        CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    201201        if (font->syntheticBoldOffset()) {
    202202            CGContextSetTextPosition(cgContext, point.x() + translation.width() + shadowOffset.width() + font->syntheticBoldOffset(), point.y() + translation.height() + shadowOffset.height());
    203             CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     203            CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    204204        }
    205205        graphicsContext->setFillColor(fillColor, ColorSpaceDeviceRGB);
     
    207207
    208208    CGContextSetTextPosition(cgContext, point.x() + translation.width(), point.y() + translation.height());
    209     CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     209    CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    210210    if (font->syntheticBoldOffset()) {
    211211        CGContextSetTextPosition(cgContext, point.x() + translation.width() + font->syntheticBoldOffset(), point.y() + translation.height());
    212         CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs);
     212        CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs);
    213213    }
    214214
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h

    r130567 r131365  
    236236extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
    237237
     238#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     239enum {
     240    wkCTFontTransformApplyShaping = (1 << 0),
     241    wkCTFontTransformApplyPositioning = (1 << 1)
     242};
     243
     244typedef int wkCTFontTransformOptions;
     245
     246extern bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options);
     247#endif
     248
    238249#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    239250
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm

    r130567 r131365  
    137137
    138138CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
     139#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     140bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options);
     141#endif
     142
    139143#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    140144CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
  • trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp

    r130612 r131365  
    5959void SVGTextMetricsBuilder::advanceSimpleText()
    6060{
    61     unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1);
     61    GlyphBuffer glyphBuffer;
     62    unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1, &glyphBuffer);
    6263    if (!metricsLength) {
    6364        m_currentMetrics = SVGTextMetrics();
  • trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp

    r130999 r131365  
    7777{
    7878    WidthIterator it(&font, run);
    79     charsConsumed += it.advance(run.length());
     79    GlyphBuffer glyphBuffer;
     80    charsConsumed += it.advance(run.length(), &glyphBuffer);
    8081    glyphName = it.lastGlyphName();
    8182    return it.runWidthSoFar();
  • trunk/Source/WebKit/mac/ChangeLog

    r131350 r131365  
     12012-10-15  Dan Bernstein  <mitz@apple.com>
     2
     3        WebKit/mac part of <rdar://problem/12470680> Font’s fast code path doesn’t support kerning and ligatures
     4        https://bugs.webkit.org/show_bug.cgi?id=99113
     5
     6        Reviewed by Tim Horton.
     7
     8        * WebCoreSupport/WebSystemInterface.mm:
     9        (InitWebCoreSystemInterface): Added wkCTFontTransformGlyphs.
     10
    1112012-10-15  David Kilzer  <ddkilzer@apple.com>
    212
  • trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm

    r130567 r131365  
    5252#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
    5353    INIT(CGContextDrawsWithCorrectShadowOffsets);
     54#endif
     55#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     56    INIT(CTFontTransformGlyphs);
    5457#endif
    5558    INIT(CopyCFLocalizationPreferredName);
  • trunk/Source/WebKit2/ChangeLog

    r131354 r131365  
     12012-10-15  Dan Bernstein  <mitz@apple.com>
     2
     3        WebKit2 part of <rdar://problem/12470680> Font’s fast code path doesn’t support kerning and ligatures
     4        https://bugs.webkit.org/show_bug.cgi?id=99113
     5
     6        Reviewed by Tim Horton.
     7
     8        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
     9        (InitWebCoreSystemInterface): Added wkCTFontTransformGlyphs.
     10
    1112012-10-15  Christophe Dumez  <christophe.dumez@intel.com>
    212
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm

    r130567 r131365  
    4747#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
    4848        INIT(CGContextDrawsWithCorrectShadowOffsets);
     49#endif
     50#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     51        INIT(CTFontTransformGlyphs);
    4952#endif
    5053        INIT(CopyCONNECTProxyResponse);
Note: See TracChangeset for help on using the changeset viewer.