diff options
author | Victoria Lease <violets@google.com> | 2013-02-12 13:36:22 -0800 |
---|---|---|
committer | Victoria Lease <violets@google.com> | 2013-02-12 14:47:43 -0800 |
commit | ded5ed963c3939a2668ce1152ab60efb7bbbb2bd (patch) | |
tree | 6622dac988ebe0457210d286a397d8efced3b8e7 /core | |
parent | 63eb2d1089c5bd2b10ae928e603cc588656e034e (diff) | |
download | frameworks_base-ded5ed963c3939a2668ce1152ab60efb7bbbb2bd.zip frameworks_base-ded5ed963c3939a2668ce1152ab60efb7bbbb2bd.tar.gz frameworks_base-ded5ed963c3939a2668ce1152ab60efb7bbbb2bd.tar.bz2 |
Count baseGlyphCount once for scripts without typefaces
Characters from complex scripts without dedicated typefaces were
getting baseGlyphCount counted twice: once in shapeFontRun() and
then a second time during SkScalerContext::getNextContext()
chaining.
This was a problem for text runs beginning with full-width Latn
characters - shapeFontRun() would get the base glyph count for
the typeface containing those characters, then realise it had no
typeface specified for the Latn script, resetting the typeface
to default without resetting the base glyph count along with it.
Mojibake full-width Latn characters, ho!
The same issue also affected Cherokee text, which this fix also
addresses.
Bug: 8127795
Bug: 8034351
Change-Id: I058d81cffbbf86426cc3c5aafcc91a76f4fe6b62
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/android/graphics/TextLayoutCache.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 7544645..1ace23e 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -785,10 +785,6 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* conte /** * Return the first typeface in the logical change, starting with this typeface, * that contains the specified unichar, or NULL if none is found. - * - * Note that this function does _not_ increment the reference count on the typeface, as the - * assumption is that its lifetime is managed elsewhere - in particular, the fallback typefaces - * for the default font live in a global cache. */ SkTypeface* TextLayoutShaper::typefaceForScript(const SkPaint* paint, SkTypeface* typeface, hb_script_t script) { @@ -798,7 +794,7 @@ SkTypeface* TextLayoutShaper::typefaceForScript(const SkPaint* paint, SkTypeface } typeface = SkCreateTypefaceForScriptNG(script, currentStyle); #if DEBUG_GLYPHS - ALOGD("Using Harfbuzz Script %d, Style %d", script, currentStyle); + ALOGD("Using Harfbuzz Script %c%c%c%c, Style %d", HB_UNTAG(script), currentStyle); #endif return typeface; } @@ -845,6 +841,7 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint) { if (baseGlyphCount != 0) { typeface = typefaceForScript(paint, typeface, hb_buffer_get_script(mBuffer)); if (!typeface) { + baseGlyphCount = 0; typeface = mDefaultTypeface; SkSafeRef(typeface); #if DEBUG_GLYPHS |