Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp

Issue 138553003: Break HarfBuzzShaper::collectHarfBuzzRuns apart (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
diff --git a/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp b/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
index 7483929dd41194d098e3542714c76aa12e3e3916..13ac6f80ffa7ef644d2849f29d95ca0854a8bf42 100644
--- a/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
+++ b/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
@@ -559,6 +559,33 @@ FloatPoint HarfBuzzShaper::adjustStartPoint(const FloatPoint& point)
return point + m_startOffset;
}
+static inline int handleMultipleUChar(
+ UChar32 character,
+ unsigned clusterLength,
+ const SimpleFontData* currentFontData,
+ const UChar* currentCharacterPosition,
+ const UChar* markCharactersEnd,
+ const UChar* normalizedBufferEnd)
+{
+ if (U_GET_GC_MASK(character) & U_GC_M_MASK) {
+ int markLength = clusterLength;
+ while (markCharactersEnd < normalizedBufferEnd) {
+ UChar32 nextCharacter;
+ int nextCharacterLength = 0;
+ U16_NEXT(markCharactersEnd, nextCharacterLength, normalizedBufferEnd - markCharactersEnd, nextCharacter);
+ if (!(U_GET_GC_MASK(nextCharacter) & U_GC_M_MASK))
+ break;
+ markLength += nextCharacterLength;
+ markCharactersEnd += nextCharacterLength;
+ }
+
+ if (currentFontData->canRenderCombiningCharacterSequence(currentCharacterPosition, markCharactersEnd - currentCharacterPosition)) {
+ return markLength;
+ }
+ }
+ return 0;
+}
+
bool HarfBuzzShaper::collectHarfBuzzRuns()
{
const UChar* normalizedBufferEnd = m_normalizedBuffer.get() + m_normalizedBufferLength;
@@ -584,23 +611,10 @@ bool HarfBuzzShaper::collectHarfBuzzRuns()
if (Font::treatAsZeroWidthSpace(character))
continue;
- if (U_GET_GC_MASK(character) & U_GC_M_MASK) {
- int markLength = clusterLength;
- const UChar* markCharactersEnd = iterator.characters() + clusterLength;
- while (markCharactersEnd < normalizedBufferEnd) {
- UChar32 nextCharacter;
- int nextCharacterLength = 0;
- U16_NEXT(markCharactersEnd, nextCharacterLength, normalizedBufferEnd - markCharactersEnd, nextCharacter);
- if (!(U_GET_GC_MASK(nextCharacter) & U_GC_M_MASK))
- break;
- markLength += nextCharacterLength;
- markCharactersEnd += nextCharacterLength;
- }
-
- if (currentFontData->canRenderCombiningCharacterSequence(currentCharacterPosition, markCharactersEnd - currentCharacterPosition)) {
- clusterLength = markLength;
- continue;
- }
+ int length = handleMultipleUChar(character, clusterLength, currentFontData, currentCharacterPosition, iterator.characters() + clusterLength, normalizedBufferEnd);
+ if (length) {
+ clusterLength = length;
+ continue;
}
nextFontData = m_font->glyphDataForCharacter(character, false).fontData;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698