diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-27 14:45:02 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-01 19:37:11 +0200 |
commit | 2c4ff38a22a2d6d13ab4a833082cc76f65af3b4f (patch) | |
tree | fd45094b1832e2210c35a4b9beaa1455778fba4c /Source/WebCore | |
parent | e4dcbab26b8b25df40b7d8937ac1306f4e19c84e (diff) |
Support kerning with SVG web fonts
https://bugs.webkit.org/show_bug.cgi?id=117540
Reviewed by Stephen Chenney.
Adds the glue to WidthIterator to take advantage of kerning in SVG web fonts.
To supply SVG font kerning with its required text input, the signature of
applyFontTransforms has been extended.
Since SVG font kerning was extremely slow, it has been sped up by replacing
the iteration over all possible kerning definitions with a hash-map based
lookup of the leading symbol to be kerned. The new algorithm provides a
roughly 100x speed-up in SVG font kerning.
Test: fast/text/svg-font-face-with-kerning.html
* platform/graphics/TextRun.h:
(WebCore::TextRun::string):
* platform/graphics/WidthIterator.cpp:
(WebCore::applyFontTransforms):
(WebCore::WidthIterator::advanceInternal):
* rendering/svg/SVGTextRunRenderingContext.cpp:
(WebCore::SVGTextRunRenderingContext::applySVGKerning):
* rendering/svg/SVGTextRunRenderingContext.h:
* svg/SVGFontElement.cpp:
(WebCore::SVGFontElement::invalidateGlyphCache):
(WebCore::SVGFontElement::ensureGlyphCache):
(WebCore::SVGKerningMap::clear):
(WebCore::SVGKerningMap::insert):
(WebCore::stringMatchesUnicodeRange):
(WebCore::stringMatchesGlyphName):
(WebCore::stringMatchesUnicodeName):
(WebCore::matches):
(WebCore::kerningForPairOfStringsAndGlyphs):
(WebCore::SVGFontElement::horizontalKerningForPairOfStringsAndGlyphs):
(WebCore::SVGFontElement::verticalKerningForPairOfStringsAndGlyphs):
* svg/SVGFontElement.h:
(WebCore::SVGKerning::SVGKerning):
(WebCore::SVGKerningMap::isEmpty):
* svg/SVGHKernElement.cpp:
(WebCore::SVGHKernElement::buildHorizontalKerningPair):
* svg/SVGHKernElement.h:
* svg/SVGVKernElement.cpp:
(WebCore::SVGVKernElement::buildVerticalKerningPair):
* svg/SVGVKernElement.h:
Change-Id: I309d05b57df3a85fa9720e56f4ace53d5d1d8cf5
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/platform/graphics/TextRun.h | 7 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/WidthIterator.cpp | 17 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp | 42 | ||||
-rw-r--r-- | Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h | 1 | ||||
-rw-r--r-- | Source/WebCore/svg/SVGFontElement.cpp | 128 | ||||
-rw-r--r-- | Source/WebCore/svg/SVGFontElement.h | 37 | ||||
-rw-r--r-- | Source/WebCore/svg/SVGHKernElement.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/svg/SVGHKernElement.h | 2 | ||||
-rw-r--r-- | Source/WebCore/svg/SVGVKernElement.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/svg/SVGVKernElement.h | 2 |
11 files changed, 194 insertions, 54 deletions
diff --git a/Source/WebCore/platform/graphics/TextRun.h b/Source/WebCore/platform/graphics/TextRun.h index 895a1e95d..2a194cc9c 100644 --- a/Source/WebCore/platform/graphics/TextRun.h +++ b/Source/WebCore/platform/graphics/TextRun.h @@ -165,6 +165,12 @@ public: bool is8Bit() const { return m_is8Bit; } int length() const { return m_len; } int charactersLength() const { return m_charactersLength; } + String string() const + { + if (is8Bit()) + return String(m_data.characters8, m_len); + return String(m_data.characters16, m_len); + } #if ENABLE(8BIT_TEXTRUN) void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;} @@ -209,6 +215,7 @@ public: virtual GlyphData glyphDataForCharacter(const Font&, const TextRun&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength) = 0; virtual void drawSVGGlyphs(GraphicsContext*, const TextRun&, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const = 0; virtual float floatWidthUsingSVGFont(const Font&, const TextRun&, int& charsConsumed, String& glyphName) const = 0; + virtual bool applySVGKerning(const SimpleFontData*, WidthIterator&, GlyphBuffer*, int from) const = 0; #endif }; diff --git a/Source/WebCore/platform/graphics/WidthIterator.cpp b/Source/WebCore/platform/graphics/WidthIterator.cpp index 5fcf94969..e8b620f8a 100644 --- a/Source/WebCore/platform/graphics/WidthIterator.cpp +++ b/Source/WebCore/platform/graphics/WidthIterator.cpp @@ -102,7 +102,7 @@ public: typedef Vector<pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace; -static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace) +static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const SimpleFontData* fontData, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, CharactersTreatedAsSpace& charactersTreatedAsSpace) { ASSERT(typesettingFeatures & (Kerning | Ligatures)); @@ -121,7 +121,16 @@ static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& if (!ltr) glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount); - fontData->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures); +#if ENABLE(SVG_FONTS) + // We need to handle transforms on SVG fonts internally, since they are rendered internally. + if (fontData->isSVGFont()) { + ASSERT(iterator.run().renderingContext()); + // SVG font ligatures are handled during glyph selection, only kerning remaining. + if (typesettingFeatures & Kerning) + iterator.run().renderingContext()->applySVGKerning(fontData, iterator, glyphBuffer, lastGlyphCount); + } else +#endif + fontData->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + lastGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures); if (!ltr) glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount); @@ -193,7 +202,7 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph if (fontData != lastFontData && width) { if (shouldApplyFontTransforms()) { - m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, charactersTreatedAsSpace); + m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, charactersTreatedAsSpace); lastGlyphCount = glyphBuffer->size(); // applyFontTransforms doesn't update when there had been only one glyph. } @@ -315,7 +324,7 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph } if (shouldApplyFontTransforms()) - m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, charactersTreatedAsSpace); + m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, charactersTreatedAsSpace); unsigned consumedCharacters = textIterator.currentCharacter() - m_currentCharacter; m_currentCharacter = textIterator.currentCharacter(); diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp index 80c253543..7e7babbcd 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp @@ -72,8 +72,10 @@ void TextureMapperLayer::computeTransformsRecursive() m_state.maskLayer->computeTransformsRecursive(); if (m_state.replicaLayer) m_state.replicaLayer->computeTransformsRecursive(); - for (size_t i = 0; i < m_children.size(); ++i) + for (size_t i = 0; i < m_children.size(); ++i) { + RELEASE_ASSERT(m_children[i]->m_parent == this); m_children[i]->computeTransformsRecursive(); + } // Reorder children if needed on the way back up. if (m_state.preserves3D) diff --git a/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp b/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp index f94b283e6..7474adfbf 100644 --- a/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp +++ b/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp @@ -81,7 +81,47 @@ float SVGTextRunRenderingContext::floatWidthUsingSVGFont(const Font& font, const glyphName = it.lastGlyphName(); return it.runWidthSoFar(); } - + +bool SVGTextRunRenderingContext::applySVGKerning(const SimpleFontData* fontData, WidthIterator& iterator, GlyphBuffer* glyphBuffer, int from) const +{ + ASSERT(glyphBuffer); + ASSERT(glyphBuffer->size() > 1); + SVGFontElement* fontElement = 0; + SVGFontFaceElement* fontFaceElement = 0; + + svgFontAndFontFaceElementForFontData(fontData, fontFaceElement, fontElement); + if (!fontElement || !fontFaceElement) + return false; + + float scale = scaleEmToUnits(fontData->platformData().size(), fontFaceElement->unitsPerEm()); + + String lastGlyphName; + String lastUnicodeString; + int characterOffset = iterator.m_currentCharacter; + String text = iterator.run().string(); + const int glyphCount = glyphBuffer->size() - from; + GlyphBufferAdvance* advances = glyphBuffer->advances(from); + + for (int i = 0; i < glyphCount; ++i) { + Glyph glyph = glyphBuffer->glyphAt(from + i); + if (!glyph) + continue; + float kerning = 0; + SVGGlyph svgGlyph = fontElement->svgGlyphForGlyph(glyph); + String unicodeString = text.substring(characterOffset, svgGlyph.unicodeStringLength); + if (i >= 1) { + // FIXME: Support vertical text. + kerning = fontElement->horizontalKerningForPairOfStringsAndGlyphs(lastUnicodeString, lastGlyphName, unicodeString, svgGlyph.glyphName); + advances[i - 1].setWidth(advances[i - 1].width() - kerning * scale); + } + lastGlyphName = svgGlyph.glyphName; + lastUnicodeString = unicodeString; + characterOffset += svgGlyph.unicodeStringLength; + } + + return true; +} + void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const TextRun& run, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const { SVGFontElement* fontElement = 0; diff --git a/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h b/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h index bb92bea8c..04b724685 100644 --- a/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h +++ b/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h @@ -45,6 +45,7 @@ public: virtual GlyphData glyphDataForCharacter(const Font&, const TextRun&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength); virtual void drawSVGGlyphs(GraphicsContext*, const TextRun&, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const; virtual float floatWidthUsingSVGFont(const Font&, const TextRun&, int& charsConsumed, String& glyphName) const; + virtual bool applySVGKerning(const SimpleFontData*, WidthIterator&, GlyphBuffer*, int from) const; #endif private: diff --git a/Source/WebCore/svg/SVGFontElement.cpp b/Source/WebCore/svg/SVGFontElement.cpp index c8ea3c830..9324e2dc4 100644 --- a/Source/WebCore/svg/SVGFontElement.cpp +++ b/Source/WebCore/svg/SVGFontElement.cpp @@ -62,8 +62,8 @@ void SVGFontElement::invalidateGlyphCache() { if (m_isGlyphCacheValid) { m_glyphMap.clear(); - m_horizontalKerningPairs.clear(); - m_verticalKerningPairs.clear(); + m_horizontalKerningMap.clear(); + m_verticalKerningMap.clear(); } m_isGlyphCacheValid = false; } @@ -137,10 +137,10 @@ void SVGFontElement::ensureGlyphCache() ligatures.append(unicode.string()); } else if (child->hasTagName(SVGNames::hkernTag)) { SVGHKernElement* hkern = static_cast<SVGHKernElement*>(child); - hkern->buildHorizontalKerningPair(m_horizontalKerningPairs); + hkern->buildHorizontalKerningPair(m_horizontalKerningMap); } else if (child->hasTagName(SVGNames::vkernTag)) { SVGVKernElement* vkern = static_cast<SVGVKernElement*>(child); - vkern->buildVerticalKerningPair(m_verticalKerningPairs); + vkern->buildVerticalKerningPair(m_verticalKerningMap); } else if (child->hasTagName(SVGNames::missing_glyphTag) && !firstMissingGlyphElement) firstMissingGlyphElement = static_cast<SVGMissingGlyphElement*>(child); } @@ -160,7 +160,50 @@ void SVGFontElement::ensureGlyphCache() m_isGlyphCacheValid = true; } -static bool stringMatchesUnicodeRange(const String& unicodeString, const UnicodeRanges& ranges, const HashSet<String>& unicodeValues) +void SVGKerningMap::clear() +{ + unicodeMap.clear(); + glyphMap.clear(); + kerningUnicodeRangeMap.clear(); +} + +void SVGKerningMap::insert(const SVGKerningPair& kerningPair) +{ + SVGKerning svgKerning; + svgKerning.kerning = kerningPair.kerning; + svgKerning.unicodeRange2 = kerningPair.unicodeRange2; + svgKerning.unicodeName2 = kerningPair.unicodeName2; + svgKerning.glyphName2 = kerningPair.glyphName2; + + HashSet<String>::const_iterator uIt = kerningPair.unicodeName1.begin(); + const HashSet<String>::const_iterator uEnd = kerningPair.unicodeName1.end(); + for (; uIt != uEnd; ++uIt) { + if (unicodeMap.contains(*uIt)) + unicodeMap.get(*uIt)->append(svgKerning); + else { + OwnPtr<SVGKerningVector> newVector = adoptPtr(new SVGKerningVector); + newVector->append(svgKerning); + unicodeMap.add(*uIt, newVector.release()); + } + } + + HashSet<String>::const_iterator gIt = kerningPair.glyphName1.begin(); + const HashSet<String>::const_iterator gEnd = kerningPair.glyphName1.end(); + for (; gIt != gEnd; ++gIt) { + if (glyphMap.contains(*gIt)) + glyphMap.get(*gIt)->append(svgKerning); + else { + OwnPtr<SVGKerningVector> newVector = adoptPtr(new SVGKerningVector); + newVector->append(svgKerning); + glyphMap.add(*gIt, newVector.release()); + } + } + + if (!kerningPair.unicodeRange1.isEmpty()) + kerningUnicodeRangeMap.append(kerningPair); +} + +static inline bool stringMatchesUnicodeRange(const String& unicodeString, const UnicodeRanges& ranges) { if (unicodeString.isEmpty()) return false; @@ -174,43 +217,68 @@ static bool stringMatchesUnicodeRange(const String& unicodeString, const Unicode } } - if (!unicodeValues.isEmpty()) - return unicodeValues.contains(unicodeString); - return false; } -static bool stringMatchesGlyphName(const String& glyphName, const HashSet<String>& glyphValues) +static inline bool stringMatchesGlyphName(const String& glyphName, const HashSet<String>& glyphValues) { if (glyphName.isEmpty()) return false; - if (!glyphValues.isEmpty()) - return glyphValues.contains(glyphName); - - return false; + return glyphValues.contains(glyphName); } -static bool matches(const String& u1, const String& g1, const String& u2, const String& g2, const SVGKerningPair& kerningPair) +static inline bool stringMatchesUnicodeName(const String& unicodeName, const HashSet<String>& unicodeValues) { - if (!stringMatchesUnicodeRange(u1, kerningPair.unicodeRange1, kerningPair.unicodeName1) - && !stringMatchesGlyphName(g1, kerningPair.glyphName1)) + if (unicodeName.isEmpty()) return false; - if (!stringMatchesUnicodeRange(u2, kerningPair.unicodeRange2, kerningPair.unicodeName2) - && !stringMatchesGlyphName(g2, kerningPair.glyphName2)) - return false; + return unicodeValues.contains(unicodeName); +} - return true; +static inline bool matches(const String& u2, const String& g2, const SVGKerning& svgKerning) +{ + return stringMatchesGlyphName(g2, svgKerning.glyphName2) + || stringMatchesUnicodeName(u2, svgKerning.unicodeName2) + || stringMatchesUnicodeRange(u2, svgKerning.unicodeRange2); } -static float kerningForPairOfStringsAndGlyphs(const KerningPairVector& kerningPairs, const String& u1, const String& g1, const String& u2, const String& g2) +static inline bool matches(const String& u1, const String& u2, const String& g2, const SVGKerningPair& svgKerningPair) { - KerningPairVector::const_iterator it = kerningPairs.end() - 1; - const KerningPairVector::const_iterator begin = kerningPairs.begin() - 1; - for (; it != begin; --it) { - if (matches(u1, g1, u2, g2, *it)) - return it->kerning; + return stringMatchesUnicodeRange(u1, svgKerningPair.unicodeRange1) && matches(u2, g2, svgKerningPair); +} + +static inline float kerningForPairOfStringsAndGlyphs(const SVGKerningMap& kerningMap, const String& u1, const String& g1, const String& u2, const String& g2) +{ + if (!g1.isEmpty() && kerningMap.glyphMap.contains(g1)) { + SVGKerningVector* kerningVector = kerningMap.glyphMap.get(g1); + SVGKerningVector::const_iterator it = kerningVector->end() - 1; + const SVGKerningVector::const_iterator begin = kerningVector->begin() - 1; + for (; it != begin; --it) { + if (matches(u2, g2, *it)) + return it->kerning; + } + } + + if (!u1.isEmpty()) { + if (kerningMap.unicodeMap.contains(u1)) { + SVGKerningVector* kerningVector = kerningMap.unicodeMap.get(u1); + SVGKerningVector::const_iterator it = kerningVector->end() - 1; + const SVGKerningVector::const_iterator begin = kerningVector->begin() - 1; + for (; it != begin; --it) { + if (matches(u2, g2, *it)) + return it->kerning; + } + } + + if (!kerningMap.kerningUnicodeRangeMap.isEmpty()) { + Vector<SVGKerningPair>::const_iterator it = kerningMap.kerningUnicodeRangeMap.end() - 1; + const Vector<SVGKerningPair>::const_iterator begin = kerningMap.kerningUnicodeRangeMap.begin() - 1; + for (; it != begin; --it) { + if (matches(u1, u2, g2, *it)) + return it->kerning; + } + } } return 0; @@ -218,18 +286,18 @@ static float kerningForPairOfStringsAndGlyphs(const KerningPairVector& kerningPa float SVGFontElement::horizontalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const { - if (m_horizontalKerningPairs.isEmpty()) + if (m_horizontalKerningMap.isEmpty()) return 0; - return kerningForPairOfStringsAndGlyphs(m_horizontalKerningPairs, u1, g1, u2, g2); + return kerningForPairOfStringsAndGlyphs(m_horizontalKerningMap, u1, g1, u2, g2); } float SVGFontElement::verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const { - if (m_verticalKerningPairs.isEmpty()) + if (m_verticalKerningMap.isEmpty()) return 0; - return kerningForPairOfStringsAndGlyphs(m_verticalKerningPairs, u1, g1, u2, g2); + return kerningForPairOfStringsAndGlyphs(m_verticalKerningMap, u1, g1, u2, g2); } void SVGFontElement::collectGlyphsForString(const String& string, Vector<SVGGlyph>& glyphs) diff --git a/Source/WebCore/svg/SVGFontElement.h b/Source/WebCore/svg/SVGFontElement.h index f1d0fb76b..a47d2b439 100644 --- a/Source/WebCore/svg/SVGFontElement.h +++ b/Source/WebCore/svg/SVGFontElement.h @@ -32,23 +32,36 @@ namespace WebCore { -// Describe an SVG <hkern>/<vkern> element -struct SVGKerningPair { +// Describe an SVG <hkern>/<vkern> element already matched on the first symbol. +struct SVGKerning { float kerning; - UnicodeRanges unicodeRange1; UnicodeRanges unicodeRange2; - HashSet<String> unicodeName1; HashSet<String> unicodeName2; - HashSet<String> glyphName1; HashSet<String> glyphName2; - - SVGKerningPair() + + SVGKerning() : kerning(0) - { - } + { } +}; + +// Describe an SVG <hkern>/<vkern> element +struct SVGKerningPair : public SVGKerning { + UnicodeRanges unicodeRange1; + HashSet<String> unicodeName1; + HashSet<String> glyphName1; }; -typedef Vector<SVGKerningPair> KerningPairVector; +typedef Vector<SVGKerning> SVGKerningVector; + +struct SVGKerningMap { + HashMap<String, OwnPtr<SVGKerningVector> > unicodeMap; + HashMap<String, OwnPtr<SVGKerningVector> > glyphMap; + Vector<SVGKerningPair> kerningUnicodeRangeMap; + + bool isEmpty() const { return unicodeMap.isEmpty() && glyphMap.isEmpty() && kerningUnicodeRangeMap.isEmpty(); } + void clear(); + void insert(const SVGKerningPair&); +}; class SVGMissingGlyphElement; @@ -82,8 +95,8 @@ private: DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) END_DECLARE_ANIMATED_PROPERTIES - KerningPairVector m_horizontalKerningPairs; - KerningPairVector m_verticalKerningPairs; + SVGKerningMap m_horizontalKerningMap; + SVGKerningMap m_verticalKerningMap; SVGGlyphMap m_glyphMap; Glyph m_missingGlyph; bool m_isGlyphCacheValid; diff --git a/Source/WebCore/svg/SVGHKernElement.cpp b/Source/WebCore/svg/SVGHKernElement.cpp index 91c1153da..a2cea535d 100644 --- a/Source/WebCore/svg/SVGHKernElement.cpp +++ b/Source/WebCore/svg/SVGHKernElement.cpp @@ -59,7 +59,7 @@ void SVGHKernElement::removedFrom(ContainerNode* rootParent) SVGElement::removedFrom(rootParent); } -void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs) +void SVGHKernElement::buildHorizontalKerningPair(SVGKerningMap& kerningMap) { String u1 = fastGetAttribute(SVGNames::u1Attr); String g1 = fastGetAttribute(SVGNames::g1Attr); @@ -74,7 +74,7 @@ void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.unicodeName1) && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.unicodeName2)) { kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat(); - kerningPairs.append(kerningPair); + kerningMap.insert(kerningPair); } } diff --git a/Source/WebCore/svg/SVGHKernElement.h b/Source/WebCore/svg/SVGHKernElement.h index 40bee191b..0d2023599 100644 --- a/Source/WebCore/svg/SVGHKernElement.h +++ b/Source/WebCore/svg/SVGHKernElement.h @@ -31,7 +31,7 @@ class SVGHKernElement FINAL : public SVGElement { public: static PassRefPtr<SVGHKernElement> create(const QualifiedName&, Document*); - void buildHorizontalKerningPair(KerningPairVector&); + void buildHorizontalKerningPair(SVGKerningMap&); private: SVGHKernElement(const QualifiedName&, Document*); diff --git a/Source/WebCore/svg/SVGVKernElement.cpp b/Source/WebCore/svg/SVGVKernElement.cpp index 4826df2a5..3695e6c93 100644 --- a/Source/WebCore/svg/SVGVKernElement.cpp +++ b/Source/WebCore/svg/SVGVKernElement.cpp @@ -60,7 +60,7 @@ void SVGVKernElement::removedFrom(ContainerNode* rootParent) SVGElement::removedFrom(rootParent); } -void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs) +void SVGVKernElement::buildVerticalKerningPair(SVGKerningMap& kerningMap) { String u1 = fastGetAttribute(SVGNames::u1Attr); String g1 = fastGetAttribute(SVGNames::g1Attr); @@ -75,7 +75,7 @@ void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs) && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.unicodeName1) && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.unicodeName2)) { kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat(); - kerningPairs.append(kerningPair); + kerningMap.insert(kerningPair); } } diff --git a/Source/WebCore/svg/SVGVKernElement.h b/Source/WebCore/svg/SVGVKernElement.h index dc3f9639b..91f2bfc06 100644 --- a/Source/WebCore/svg/SVGVKernElement.h +++ b/Source/WebCore/svg/SVGVKernElement.h @@ -30,7 +30,7 @@ class SVGVKernElement FINAL : public SVGElement { public: static PassRefPtr<SVGVKernElement> create(const QualifiedName&, Document*); - void buildVerticalKerningPair(KerningPairVector&); + void buildVerticalKerningPair(SVGKerningMap&); private: SVGVKernElement(const QualifiedName&, Document*); |