Source/WebCore: WebCore part of <rdar://problem/12470680> Font’s fast code path doesn...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2012 21:50:53 +0000 (21:50 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2012 21:50:53 +0000 (21:50 +0000)
commit8a9aac73d3182b4a550f7676415be8e5114c6138
tree0c5275ade0c261c060044d8ba4a8230dc98c0564
parentcd84dac90ae1a2ca4427b73a95270a006a20a3f4
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/graphics/Font.cpp
Source/WebCore/platform/graphics/FontFastPath.cpp
Source/WebCore/platform/graphics/GlyphBuffer.h
Source/WebCore/platform/graphics/SimpleFontData.h
Source/WebCore/platform/graphics/WidthIterator.cpp
Source/WebCore/platform/graphics/WidthIterator.h
Source/WebCore/platform/graphics/mac/FontMac.mm
Source/WebCore/platform/graphics/win/FontCGWin.cpp
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp
Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm