Index: Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
index 44fcb3245b14168d38ef1e73f4016025a5fbcc78..c32f25889a734dff979e763cfdea3a365d93bd51 100644 |
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
@@ -215,26 +215,6 @@ static inline float harfBuzzPositionToFloat(hb_position_t value) |
return static_cast<float>(value) / (1 << 16); |
} |
-static inline unsigned countGraphemesInCluster(const UChar* normalizedBuffer, unsigned normalizedBufferLength, uint16_t startIndex, uint16_t endIndex) |
-{ |
- if (startIndex > endIndex) { |
- uint16_t tempIndex = startIndex; |
- startIndex = endIndex; |
- endIndex = tempIndex; |
- } |
- uint16_t length = endIndex - startIndex; |
- ASSERT(static_cast<unsigned>(startIndex + length) <= normalizedBufferLength); |
- TextBreakIterator* cursorPosIterator = cursorMovementIterator(&normalizedBuffer[startIndex], length); |
- |
- int cursorPos = cursorPosIterator->current(); |
- int numGraphemes = -1; |
- while (0 <= cursorPos) { |
- cursorPos = cursorPosIterator->next(); |
- numGraphemes++; |
- } |
- return numGraphemes < 0 ? 0 : numGraphemes; |
-} |
- |
inline HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, hb_direction_t direction, hb_script_t script) |
: m_fontData(fontData) |
, m_startIndex(startIndex) |
@@ -1076,7 +1056,7 @@ float HarfBuzzShaper::fillGlyphBufferForTextEmphasis(GlyphBuffer* glyphBuffer, H |
else |
clusterEnd = isRunEnd ? currentRun->startIndex() + currentRun->numCharacters() : currentRun->glyphToCharacterIndex(i + 1); |
- graphemesInCluster = countGraphemesInCluster(m_normalizedBuffer.get(), m_normalizedBufferLength, clusterStart, clusterEnd); |
+ graphemesInCluster = countCharactersAndGraphemesInCluster(m_normalizedBuffer.get(), m_normalizedBufferLength, clusterStart, clusterEnd).graphemes; |
if (!graphemesInCluster || !clusterAdvance) |
continue; |