Index: third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp |
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp |
index c75d18caeddd36d9e9f498ab54c945c3764b35e3..ef740a26bdc601abcd80716575c46ba4a8c394ca 100644 |
--- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp |
@@ -21,11 +21,13 @@ inline void addGlyphToBuffer(GlyphBuffer* glyphBuffer, |
float advance, |
hb_direction_t direction, |
const SimpleFontData* fontData, |
- const HarfBuzzRunGlyphData& glyphData) { |
+ const HarfBuzzRunGlyphData& glyphData, |
+ unsigned characterIndex) { |
FloatPoint startOffset = HB_DIRECTION_IS_HORIZONTAL(direction) |
? FloatPoint(advance, 0) |
: FloatPoint(0, advance); |
- glyphBuffer->add(glyphData.glyph, fontData, startOffset + glyphData.offset); |
+ glyphBuffer->add(glyphData.glyph, fontData, startOffset + glyphData.offset, |
+ characterIndex); |
} |
inline void addEmphasisMark(GlyphBuffer* buffer, |
@@ -98,7 +100,7 @@ float ShapeResultBuffer::fillGlyphBufferForRun(GlyphBuffer* glyphBuffer, |
(direction == TextDirection::Ltr && |
currentCharacterIndex < to)) { |
addGlyphToBuffer(glyphBuffer, advanceSoFar, run->m_direction, |
- run->m_fontData.get(), glyphData); |
+ run->m_fontData.get(), glyphData, currentCharacterIndex); |
advanceSoFar += glyphData.advance; |
} |
} |
@@ -202,6 +204,7 @@ float ShapeResultBuffer::fillFastHorizontalGlyphBuffer( |
float advance = 0; |
+ unsigned characterIndex = 0; |
for (unsigned i = 0; i < m_results.size(); ++i) { |
const auto& wordResult = isLeftToRightDirection(dir) |
? m_results[i] |
@@ -216,10 +219,12 @@ float ShapeResultBuffer::fillFastHorizontalGlyphBuffer( |
ASSERT(!glyphData.offset.height()); |
glyphBuffer->add(glyphData.glyph, run->m_fontData.get(), |
- advance + glyphData.offset.width()); |
+ advance + glyphData.offset.width(), |
+ characterIndex + glyphData.characterIndex); |
advance += glyphData.advance; |
} |
} |
+ characterIndex += wordResult->m_numCharacters; |
} |
ASSERT(!glyphBuffer->hasVerticalOffsets()); |