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

Unified Diff: Source/platform/fonts/SimpleFontData.cpp

Issue 1047123002: Fix font selection for combining character sequences (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « LayoutTests/platform/linux/fast/text/missing-glyph-in-combining-character-sequence-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/SimpleFontData.cpp
diff --git a/Source/platform/fonts/SimpleFontData.cpp b/Source/platform/fonts/SimpleFontData.cpp
index 5b0d89ef2fea8fce06956f60dd968a9438b4271b..2cf34e2e0256e0eaef99522f0717ac879c1cd148 100644
--- a/Source/platform/fonts/SimpleFontData.cpp
+++ b/Source/platform/fonts/SimpleFontData.cpp
@@ -461,19 +461,20 @@ bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters
UErrorCode error = U_ZERO_ERROR;
Vector<UChar, 4> normalizedCharacters(length);
- int32_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UNORM_UNICODE_3_2, &normalizedCharacters[0], length, &error);
+ size_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UNORM_UNICODE_3_2, &normalizedCharacters[0], length, &error);
// Can't render if we have an error or no composition occurred.
- if (U_FAILURE(error) || (static_cast<size_t>(normalizedLength) == length))
+ if (U_FAILURE(error) || normalizedLength == length)
return false;
- SkPaint paint;
- m_platformData.setupPaint(&paint);
- paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
- if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) {
- addResult.storedValue->value = true;
- return true;
+ for (size_t offset = 0; offset < normalizedLength;) {
+ UChar32 character;
+ U16_NEXT(normalizedCharacters, offset, normalizedLength, character);
+ if (!glyphForCharacter(character))
+ return false;
}
- return false;
+
+ addResult.storedValue->value = true;
+ return true;
}
bool SimpleFontData::fillGlyphPage(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength) const
« no previous file with comments | « LayoutTests/platform/linux/fast/text/missing-glyph-in-combining-character-sequence-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698