WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Add kerning and ligature support on the fast code path (this patch excludes WebKitLibraries changes)
bug-99113-20121012130726.patch (text/plain), 31.16 KB, created by
mitz
on 2012-10-12 13:08:31 PDT
(
hide
)
Description:
Add kerning and ligature support on the fast code path (this patch excludes WebKitLibraries changes)
Filename:
MIME Type:
Creator:
mitz
Created:
2012-10-12 13:08:31 PDT
Size:
31.16 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 131205) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,56 @@ >+2012-10-11 Dan Bernstein <mitz@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ * 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. >+ > 2012-10-12 Scott Graham <scottmg@chromium.org> > > Local disable of stack corruption warning when compiling on VS2012 >Index: Source/WebCore/WebCore.exp.in >=================================================================== >--- Source/WebCore/WebCore.exp.in (revision 131205) >+++ Source/WebCore/WebCore.exp.in (working copy) >@@ -1449,6 +1449,9 @@ _wkCGContextResetClip > _wkCGContextDrawsWithCorrectShadowOffsets > #endif > _wkCGPatternCreateWithImageAndTransform >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 >+_wkCTFontTransformGlyphs >+#endif > _wkCopyCFLocalizationPreferredName > _wkCopyCFURLResponseSuggestedFilename > _wkCopyCONNECTProxyResponse >Index: Source/WebCore/platform/graphics/Font.cpp >=================================================================== >--- Source/WebCore/platform/graphics/Font.cpp (revision 131205) >+++ Source/WebCore/platform/graphics/Font.cpp (working copy) >@@ -187,7 +187,8 @@ float Font::width(const TextRun& run, Ha > // If the complex text implementation cannot return fallback fonts, avoid > // returning them for simple text as well. > static bool returnFallbackFonts = canReturnFallbackFontsForComplexText(); >- return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow || (glyphOverflow && glyphOverflow->computeBounds) ? glyphOverflow : 0); >+ GlyphBuffer glyphBuffer; >+ return floatWidthForSimpleText(run, &glyphBuffer, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow || (glyphOverflow && glyphOverflow->computeBounds) ? glyphOverflow : 0); > } > > return floatWidthForComplexText(run, fallbackFonts, glyphOverflow); >@@ -314,7 +315,7 @@ Font::CodePath Font::codePath(const Text > if (m_fontDescription.featureSettings() && m_fontDescription.featureSettings()->size() > 0) > return Complex; > >- if (run.length() > 1 && typesettingFeatures()) >+ if (run.length() > 1 && !WidthIterator::supportsTypesettingFeatures(*this)) > return Complex; > > if (!run.characterScanForCodePath()) >Index: Source/WebCore/platform/graphics/FontFastPath.cpp >=================================================================== >--- Source/WebCore/platform/graphics/FontFastPath.cpp (revision 131205) >+++ Source/WebCore/platform/graphics/FontFastPath.cpp (working copy) >@@ -333,7 +333,10 @@ float Font::getGlyphsAndAdvancesForSimpl > float initialAdvance; > > WidthIterator it(this, run, 0, false, forTextEmphasis); >- it.advance(from); >+ // FIXME: Using separate glyph buffers for the prefix and the suffix is incorrect when kerning or >+ // ligatures are enabled. >+ GlyphBuffer localGlyphBuffer; >+ it.advance(from, &localGlyphBuffer); > float beforeWidth = it.m_runWidthSoFar; > it.advance(to, &glyphBuffer); > >@@ -344,7 +347,7 @@ float Font::getGlyphsAndAdvancesForSimpl > > if (run.rtl()) { > float finalRoundingWidth = it.m_finalRoundingWidth; >- it.advance(run.length()); >+ it.advance(run.length(), &localGlyphBuffer); > initialAdvance = finalRoundingWidth + it.m_runWidthSoFar - afterWidth; > } else > initialAdvance = beforeWidth; >@@ -488,15 +491,16 @@ float Font::floatWidthForSimpleText(cons > > FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const > { >+ GlyphBuffer glyphBuffer; > WidthIterator it(this, run); >- it.advance(from); >+ it.advance(from, &glyphBuffer); > float beforeWidth = it.m_runWidthSoFar; >- it.advance(to); >+ it.advance(to, &glyphBuffer); > float afterWidth = it.m_runWidthSoFar; > > // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning. > if (run.rtl()) { >- it.advance(run.length()); >+ it.advance(run.length(), &glyphBuffer); > float totalWidth = it.m_runWidthSoFar; > return FloatRect(floorf(point.x() + totalWidth - afterWidth), point.y(), roundf(point.x() + totalWidth - beforeWidth) - floorf(point.x() + totalWidth - afterWidth), h); > } >@@ -516,7 +520,7 @@ int Font::offsetForPositionForSimpleText > while (1) { > offset = it.m_currentCharacter; > float w; >- if (!it.advanceOneCharacter(w, &localGlyphBuffer)) >+ if (!it.advanceOneCharacter(w, localGlyphBuffer)) > break; > delta += w; > if (includePartialGlyphs) { >@@ -531,7 +535,7 @@ int Font::offsetForPositionForSimpleText > while (1) { > offset = it.m_currentCharacter; > float w; >- if (!it.advanceOneCharacter(w, &localGlyphBuffer)) >+ if (!it.advanceOneCharacter(w, localGlyphBuffer)) > break; > delta -= w; > if (includePartialGlyphs) { >Index: Source/WebCore/platform/graphics/GlyphBuffer.h >=================================================================== >--- Source/WebCore/platform/graphics/GlyphBuffer.h (revision 131205) >+++ Source/WebCore/platform/graphics/GlyphBuffer.h (working copy) >@@ -63,11 +63,32 @@ typedef Glyph GlyphBufferGlyph; > // CG uses CGSize instead of FloatSize so that the result of advances() > // can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm > #if USE(CG) || (OS(DARWIN) && (PLATFORM(WX) || PLATFORM(CHROMIUM))) >-typedef CGSize GlyphBufferAdvance; >+struct GlyphBufferAdvance : CGSize { >+public: >+ GlyphBufferAdvance(CGSize size) : CGSize(size) >+ { >+ } >+ >+ void setWidth(CGFloat width) { this->CGSize::width = width; } >+ CGFloat width() const { return this->CGSize::width; } >+}; > #elif OS(WINCE) > // There is no cross-platform code that uses the height of GlyphBufferAdvance, > // so we can save memory space on embedded devices by storing only the width >-typedef float GlyphBufferAdvance; >+struct GlyphBufferAdvance { >+public: >+ GlyphBufferAdvance(float width) >+ : advance(width) >+ { >+ } >+ >+ void setWidth(float width) { advance = width; } >+ float& width() { return advance; } >+ const float& width() const { return advance; } >+ >+private: >+ float advance; >+}; > #else > typedef FloatSize GlyphBufferAdvance; > #endif >@@ -126,13 +147,7 @@ public: > > float advanceAt(int index) const > { >-#if USE(CG) || (OS(DARWIN) && (PLATFORM(WX) || PLATFORM(CHROMIUM))) >- return m_advances[index].width; >-#elif OS(WINCE) >- return m_advances[index]; >-#else > return m_advances[index].width(); >-#endif > } > > FloatSize offsetAt(int index) const >@@ -196,13 +211,7 @@ public: > { > ASSERT(!isEmpty()); > GlyphBufferAdvance& lastAdvance = m_advances.last(); >-#if USE(CG) || (OS(DARWIN) && (PLATFORM(WX) || PLATFORM(CHROMIUM))) >- lastAdvance.width += width; >-#elif OS(WINCE) >- lastAdvance += width; >-#else >- lastAdvance += FloatSize(width, 0); >-#endif >+ lastAdvance.setWidth(lastAdvance.width() + width); > } > > private: >Index: Source/WebCore/platform/graphics/SimpleFontData.h >=================================================================== >--- Source/WebCore/platform/graphics/SimpleFontData.h (revision 131205) >+++ Source/WebCore/platform/graphics/SimpleFontData.h (working copy) >@@ -29,6 +29,7 @@ > #include "FontMetrics.h" > #include "FontPlatformData.h" > #include "FloatRect.h" >+#include "GlyphBuffer.h" > #include "GlyphMetricsMap.h" > #include "GlyphPageTreeNode.h" > #if ENABLE(OPENTYPE_VERTICAL) >@@ -37,8 +38,13 @@ > #include "TypesettingFeatures.h" > #include <wtf/OwnPtr.h> > #include <wtf/PassOwnPtr.h> >+#include <wtf/UnusedParam.h> > #include <wtf/text/StringHash.h> > >+#if PLATFORM(MAC) >+#include "WebCoreSystemInterface.h" >+#endif >+ > #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN)) > #include <wtf/RetainPtr.h> > #endif >@@ -190,6 +196,21 @@ public: > bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; > #endif > >+ bool applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const >+ { >+#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080 >+ UNUSED_PARAM(glyphs); >+ UNUSED_PARAM(advances); >+ UNUSED_PARAM(glyphCount); >+ UNUSED_PARAM(typesettingFeatures); >+ ASSERT_NOT_REACHED(); >+ return false; >+#else >+ wkCTFontTransformOptions options = (typesettingFeatures & Kerning ? wkCTFontTransformApplyPositioning : 0) | (typesettingFeatures & Ligatures ? wkCTFontTransformApplyShaping : 0); >+ return wkCTFontTransformGlyphs(m_platformData.ctFont(), glyphs, reinterpret_cast<CGSize*>(advances), glyphCount, options); >+#endif >+ } >+ > #if PLATFORM(QT) > QRawFont getQtRawFont() const { return m_platformData.rawFont(); } > #endif >Index: Source/WebCore/platform/graphics/WidthIterator.cpp >=================================================================== >--- Source/WebCore/platform/graphics/WidthIterator.cpp (revision 131205) >+++ Source/WebCore/platform/graphics/WidthIterator.cpp (working copy) >@@ -43,6 +43,7 @@ WidthIterator::WidthIterator(const Font* > , m_runWidthSoFar(0) > , m_isAfterExpansion(!run.allowsLeadingExpansion()) > , m_finalRoundingWidth(0) >+ , m_typesettingFeatures(font->typesettingFeatures()) > , m_fallbackFonts(fallbackFonts) > , m_accountForGlyphBounds(accountForGlyphBounds) > , m_maxGlyphBoundingBoxY(numeric_limits<float>::min()) >@@ -84,6 +85,66 @@ GlyphData WidthIterator::glyphDataForCha > return m_font->glyphDataForCharacter(character, mirror); > } > >+struct OriginalAdvancesForCharacterTreatedAsSpace { >+public: >+ OriginalAdvancesForCharacterTreatedAsSpace(bool isSpace, float advanceBefore, float advanceAt) >+ : characterIsSpace(isSpace) >+ , advanceBeforeCharacter(advanceBefore) >+ , advanceAtCharacter(advanceAt) >+ { >+ } >+ >+ bool characterIsSpace; >+ float advanceBeforeCharacter; >+ float advanceAtCharacter; >+}; >+ >+typedef Vector<pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace; >+ >+static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace) >+{ >+ ASSERT(typesettingFeatures & (Kerning | Ligatures)); >+ >+ if (!glyphBuffer) >+ return 0; >+ >+ int glyphBufferSize = glyphBuffer->size(); >+ if (glyphBuffer->size() <= lastGlyphCount) >+ return 0; >+ >+ GlyphBufferAdvance* advances = glyphBuffer->advances(0); >+ float widthDifference = 0; >+ for (int i = lastGlyphCount; i < glyphBufferSize; ++i) >+ widthDifference -= advances[i].width(); >+ >+ if (!ltr) { >+ for (int i = 0, end = glyphBuffer->size() - 1; i < glyphBuffer->size() / 2; ++i, --end) >+ glyphBuffer->swap(i, end); >+ } >+ >+ fontData->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures); >+ >+ if (!ltr) { >+ for (int i = 0, end = glyphBuffer->size() - 1; i < glyphBuffer->size() / 2; ++i, --end) >+ glyphBuffer->swap(i, end); >+ } >+ >+ for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) { >+ int spaceOffset = charactersTreatedAsSpace[i].first; >+ const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = charactersTreatedAsSpace[i].second; >+ if (spaceOffset && !originalAdvances.characterIsSpace) >+ glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.advanceBeforeCharacter); >+ glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtCharacter); >+ } >+ charactersTreatedAsSpace.clear(); >+ >+ for (int i = lastGlyphCount; i < glyphBufferSize; ++i) >+ widthDifference += advances[i].width(); >+ >+ lastGlyphCount = glyphBufferSize; >+ return widthDifference; >+} >+ > template <typename TextIterator> > inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, GlyphBuffer* glyphBuffer) > { >@@ -99,10 +160,11 @@ inline unsigned WidthIterator::advanceIn > > const SimpleFontData* primaryFont = m_font->primaryFont(); > const SimpleFontData* lastFontData = primaryFont; >+ int lastGlyphCount = glyphBuffer ? glyphBuffer->size() : 0; > > UChar32 character = 0; > unsigned clusterLength = 0; >- >+ CharactersTreatedAsSpace charactersTreatedAsSpace; > while (textIterator.consume(character, clusterLength)) { > unsigned advanceLength = clusterLength; > const GlyphData& glyphData = glyphDataForCharacter(character, rtl, textIterator.currentCharacter(), advanceLength); >@@ -132,6 +194,9 @@ inline unsigned WidthIterator::advanceIn > } > > if (fontData != lastFontData && width) { >+ if (shouldApplyFontTransforms()) >+ m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, charactersTreatedAsSpace); >+ > lastFontData = fontData; > if (m_fallbackFonts && fontData != primaryFont) { > // FIXME: This does a little extra work that could be avoided if >@@ -187,6 +252,10 @@ inline unsigned WidthIterator::advanceIn > m_isAfterExpansion = false; > } > >+ if (shouldApplyFontTransforms() && glyphBuffer && Font::treatAsSpace(character)) >+ charactersTreatedAsSpace.append(make_pair(glyphBuffer->size(), >+ OriginalAdvancesForCharacterTreatedAsSpace(character == ' ', glyphBuffer->size() ? glyphBuffer->advanceAt(glyphBuffer->size() - 1) : 0, width))); >+ > if (m_accountForGlyphBounds) { > bounds = fontData->boundsForGlyph(glyph); > if (!textIterator.currentCharacter()) >@@ -239,6 +308,9 @@ inline unsigned WidthIterator::advanceIn > } > } > >+ if (shouldApplyFontTransforms()) >+ m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, charactersTreatedAsSpace); >+ > unsigned consumedCharacters = textIterator.currentCharacter() - m_currentCharacter; > m_currentCharacter = textIterator.currentCharacter(); > m_runWidthSoFar += widthSinceLastRounding; >@@ -265,15 +337,15 @@ unsigned WidthIterator::advance(int offs > return advanceInternal(textIterator, glyphBuffer); > } > >-bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer) >+bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer& glyphBuffer) > { >- int oldSize = glyphBuffer->size(); >- advance(m_currentCharacter + 1, glyphBuffer); >+ int oldSize = glyphBuffer.size(); >+ advance(m_currentCharacter + 1, &glyphBuffer); > float w = 0; >- for (int i = oldSize; i < glyphBuffer->size(); ++i) >- w += glyphBuffer->advanceAt(i); >+ for (int i = oldSize; i < glyphBuffer.size(); ++i) >+ w += glyphBuffer.advanceAt(i); > width = w; >- return glyphBuffer->size() > oldSize; >+ return glyphBuffer.size() > oldSize; > } > > } >Index: Source/WebCore/platform/graphics/WidthIterator.h >=================================================================== >--- Source/WebCore/platform/graphics/WidthIterator.h (revision 131205) >+++ Source/WebCore/platform/graphics/WidthIterator.h (working copy) >@@ -22,6 +22,7 @@ > #ifndef WidthIterator_h > #define WidthIterator_h > >+#include "Font.h" > #include "SVGGlyph.h" > #include <wtf/HashSet.h> > #include <wtf/Vector.h> >@@ -40,8 +41,8 @@ struct WidthIterator { > public: > WidthIterator(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false); > >- unsigned advance(int to, GlyphBuffer* = 0); >- bool advanceOneCharacter(float& width, GlyphBuffer* = 0); >+ unsigned advance(int to, GlyphBuffer*); >+ bool advanceOneCharacter(float& width, GlyphBuffer&); > > float maxGlyphBoundingBoxY() const { ASSERT(m_accountForGlyphBounds); return m_maxGlyphBoundingBoxY; } > float minGlyphBoundingBoxY() const { ASSERT(m_accountForGlyphBounds); return m_minGlyphBoundingBoxY; } >@@ -57,6 +58,18 @@ public: > Vector<SVGGlyph::ArabicForm>& arabicForms() { return m_arabicForms; } > #endif > >+ static bool supportsTypesettingFeatures(const Font& font) >+ { >+#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080 >+ return !font.typesettingFeatures(); >+#else >+ if (!font.isPrinterFont()) >+ return !font.typesettingFeatures(); >+ >+ return !(font.typesettingFeatures() & ~(Kerning | Ligatures)); >+#endif >+ } >+ > const Font* m_font; > > const TextRun& m_run; >@@ -78,6 +91,9 @@ private: > template <typename TextIterator> > inline unsigned advanceInternal(TextIterator&, GlyphBuffer*); > >+ bool shouldApplyFontTransforms() const { return m_typesettingFeatures & (Kerning | Ligatures); } >+ >+ TypesettingFeatures m_typesettingFeatures; > HashSet<const SimpleFontData*>* m_fallbackFonts; > bool m_accountForGlyphBounds; > float m_maxGlyphBoundingBoxY; >Index: Source/WebCore/platform/graphics/mac/FontMac.mm >=================================================================== >--- Source/WebCore/platform/graphics/mac/FontMac.mm (revision 131205) >+++ Source/WebCore/platform/graphics/mac/FontMac.mm (working copy) >@@ -241,15 +241,15 @@ void Font::drawGlyphs(GraphicsContext* c > float shadowTextX = point.x() + shadowOffset.width(); > // If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative. > float shadowTextY = point.y() + shadowOffset.height() * (context->shadowsIgnoreTransforms() ? -1 : 1); >- showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > if (syntheticBoldOffset) >- showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > context->setFillColor(fillColor, fillColorSpace); > } > >- showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > if (syntheticBoldOffset) >- showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > > if (hasSimpleShadow) > context->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); >Index: Source/WebCore/platform/graphics/win/FontCGWin.cpp >=================================================================== >--- Source/WebCore/platform/graphics/win/FontCGWin.cpp (revision 131205) >+++ Source/WebCore/platform/graphics/win/FontCGWin.cpp (working copy) >@@ -197,19 +197,19 @@ void Font::drawGlyphs(GraphicsContext* g > // If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative. > float shadowTextY = point.y() + translation.height() + shadowOffset.height() * (graphicsContext->shadowsIgnoreTransforms() ? -1 : 1); > CGContextSetTextPosition(cgContext, shadowTextX, shadowTextY); >- CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > if (font->syntheticBoldOffset()) { > CGContextSetTextPosition(cgContext, point.x() + translation.width() + shadowOffset.width() + font->syntheticBoldOffset(), point.y() + translation.height() + shadowOffset.height()); >- CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > } > graphicsContext->setFillColor(fillColor, ColorSpaceDeviceRGB); > } > > CGContextSetTextPosition(cgContext, point.x() + translation.width(), point.y() + translation.height()); >- CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > if (font->syntheticBoldOffset()) { > CGContextSetTextPosition(cgContext, point.x() + translation.width() + font->syntheticBoldOffset(), point.y() + translation.height()); >- CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); >+ CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), static_cast<const CGSize*>(glyphBuffer.advances(from)), numGlyphs); > } > > if (hasSimpleShadow) >Index: Source/WebCore/platform/mac/WebCoreSystemInterface.h >=================================================================== >--- Source/WebCore/platform/mac/WebCoreSystemInterface.h (revision 131205) >+++ Source/WebCore/platform/mac/WebCoreSystemInterface.h (working copy) >@@ -235,6 +235,17 @@ extern int (*wkGetNSEventMomentumPhase)( > > extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); > >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 >+enum { >+ wkCTFontTransformApplyShaping = (1 << 0), >+ wkCTFontTransformApplyPositioning = (1 << 1) >+}; >+ >+typedef int wkCTFontTransformOptions; >+ >+extern bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options); >+#endif >+ > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 > > extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); >Index: Source/WebCore/platform/mac/WebCoreSystemInterface.mm >=================================================================== >--- Source/WebCore/platform/mac/WebCoreSystemInterface.mm (revision 131205) >+++ Source/WebCore/platform/mac/WebCoreSystemInterface.mm (working copy) >@@ -136,6 +136,10 @@ int (*wkGetNSEventMomentumPhase)(NSEvent > #endif > > CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 >+bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options); >+#endif >+ > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 > CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); > >Index: Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp (revision 131205) >+++ Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp (working copy) >@@ -58,7 +58,8 @@ bool SVGTextMetricsBuilder::advance() > > void SVGTextMetricsBuilder::advanceSimpleText() > { >- unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1); >+ GlyphBuffer glyphBuffer; >+ unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1, &glyphBuffer); > if (!metricsLength) { > m_currentMetrics = SVGTextMetrics(); > return; >Index: Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (revision 131205) >+++ Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (working copy) >@@ -76,7 +76,8 @@ static inline RenderSVGResource* activeP > float SVGTextRunRenderingContext::floatWidthUsingSVGFont(const Font& font, const TextRun& run, int& charsConsumed, String& glyphName) const > { > WidthIterator it(&font, run); >- charsConsumed += it.advance(run.length()); >+ GlyphBuffer glyphBuffer; >+ charsConsumed += it.advance(run.length(), &glyphBuffer); > glyphName = it.lastGlyphName(); > return it.runWidthSoFar(); > } >Index: Source/WebKit2/ChangeLog >=================================================================== >--- Source/WebKit2/ChangeLog (revision 131205) >+++ Source/WebKit2/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2012-10-11 Dan Bernstein <mitz@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: >+ (InitWebCoreSystemInterface): Added wkCTFontTransformGlyphs. >+ > 2012-10-12 Anders Carlsson <andersca@apple.com> > > Stop using deprecatedSend inside ConnectionMac.cpp >Index: Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm >=================================================================== >--- Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (revision 131205) >+++ Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (working copy) >@@ -47,6 +47,9 @@ void InitWebCoreSystemInterface(void) > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 > INIT(CGContextDrawsWithCorrectShadowOffsets); > #endif >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 >+ INIT(CTFontTransformGlyphs); >+#endif > INIT(CopyCONNECTProxyResponse); > INIT(CopyNSURLResponseStatusLine); > INIT(CreateCTLineWithUniCharProvider); >Index: Source/WebKit/mac/ChangeLog >=================================================================== >--- Source/WebKit/mac/ChangeLog (revision 131205) >+++ Source/WebKit/mac/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2012-10-11 Dan Bernstein <mitz@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebSystemInterface.mm: >+ (InitWebCoreSystemInterface): Added wkCTFontTransformGlyphs. >+ > 2012-10-10 Brady Eidson <beidson@apple.com> > > Switch ResourceLoader::resourceData() from SharedBuffer to ResourceBuffer >Index: Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm >=================================================================== >--- Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (revision 131205) >+++ Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (working copy) >@@ -52,6 +52,9 @@ void InitWebCoreSystemInterface(void) > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 > INIT(CGContextDrawsWithCorrectShadowOffsets); > #endif >+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 >+ INIT(CTFontTransformGlyphs); >+#endif > INIT(CopyCFLocalizationPreferredName); > INIT(CopyCONNECTProxyResponse); > INIT(CopyNSURLResponseStatusLine);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 99113
:
168320
|
168322
|
168438
|
168442
| 168465