diff options
| author | 2013-05-06 15:00:41 -0700 | |
|---|---|---|
| committer | 2013-05-06 15:00:41 -0700 | |
| commit | dd0a91294bc6b57c701bdb85b9e920207eeae55a (patch) | |
| tree | 34b1fbe9d106e4e916f0a959ed82835a94dbf69b | |
| parent | 339ac85483145972da010ad34cbcb29ed70cb822 (diff) | |
Fix bug 8717690 Full-width Latin Letters Garbled on Tumblr App
For fullwidth latin (or, more generally, a font considered as a complex
script, but not supported by the font specified), and for a font other
than a system default font, we were getting a mismatch in baseGlyphCount
between the shaping and painting fonts.
This patch preserves the original typeface in this case. In that sense,
it is a slightly more general fix for bug 8127795.
Change-Id: Ibdbfdb34eb7dc39cc8f0784a67c93c9af4ce6ab2
| -rw-r--r-- | core/jni/android/graphics/TextLayoutCache.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 17f205ded27a..1d98adf2e404 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -826,27 +826,26 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint) { baseGlyphCount = paint->getBaseGlyphCount(firstUnichar); } + SkTypeface* scriptTypeface = NULL; if (baseGlyphCount != 0) { - SkTypeface::Style style = SkTypeface::kNormal; - if (typeface != NULL) { - style = typeface->style(); - } - typeface = typefaceForScript(paint, typeface, hb_buffer_get_script(mBuffer)); - if (!typeface) { - baseGlyphCount = 0; - typeface = SkFontHost::CreateTypeface(NULL, NULL, style); + scriptTypeface = typefaceForScript(paint, typeface, + hb_buffer_get_script(mBuffer)); #if DEBUG_GLYPHS - ALOGD("Using Default Typeface"); + ALOGD("Using Default Typeface for script %c%c%c%c", + HB_UNTAG(hb_buffer_get_script(mBuffer))); #endif - } + } + if (scriptTypeface) { + typeface = scriptTypeface; } else { - if (!typeface) { + baseGlyphCount = 0; + if (typeface) { + SkSafeRef(typeface); + } else { typeface = SkFontHost::CreateTypeface(NULL, NULL, SkTypeface::kNormal); #if DEBUG_GLYPHS ALOGD("Using Default Typeface (normal style)"); #endif - } else { - SkSafeRef(typeface); } } |