diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2011-04-18 17:19:36 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-04-18 17:19:36 -0700 |
commit | 4af51a14febf0c6caf844f4620c423c6dd46bfab (patch) | |
tree | 16fbc4e9542be3300222437e34eba93e5dd8a3a3 /core | |
parent | f76dc56c33ba66138af70d72803cf55f881c3717 (diff) | |
parent | 06732fde78b1caf8b5e6c0ef93357cfacedd1823 (diff) | |
download | frameworks_base-4af51a14febf0c6caf844f4620c423c6dd46bfab.zip frameworks_base-4af51a14febf0c6caf844f4620c423c6dd46bfab.tar.gz frameworks_base-4af51a14febf0c6caf844f4620c423c6dd46bfab.tar.bz2 |
Merge "Return chars advances instead of glyphs advances"
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/android/graphics/RtlProperties.h | 2 | ||||
-rw-r--r-- | core/jni/android/graphics/TextLayoutCache.cpp | 26 |
2 files changed, 19 insertions, 9 deletions
diff --git a/core/jni/android/graphics/RtlProperties.h b/core/jni/android/graphics/RtlProperties.h index 4fac89a..a41c91b 100644 --- a/core/jni/android/graphics/RtlProperties.h +++ b/core/jni/android/graphics/RtlProperties.h @@ -52,7 +52,7 @@ static RtlDebugLevel readRtlDebugLevel() { #define DEBUG_ADVANCES 0 // Define if we want (1) to have Glyphs debug values or not (0) -#define DEBUG_GLYPHS 1 +#define DEBUG_GLYPHS 0 } // namespace android #endif // ANDROID_RTL_PROPERTIES_H diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 088202e..77a731a 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -420,7 +420,9 @@ void TextLayoutCacheValue::computeValuesWithHarfbuzz(SkPaint* paint, const UChar UBiDi* bidi = ubidi_open(); if (bidi) { UErrorCode status = U_ZERO_ERROR; +#if DEBUG_GLYPHS LOGD("computeValuesWithHarfbuzz -- bidiReq=%d", bidiReq); +#endif ubidi_setPara(bidi, chars, contextCount, bidiReq, NULL, &status); if (U_SUCCESS(status)) { int paraDir = ubidi_getParaLevel(bidi) & kDirection_Mask; // 0 if ltr, 1 if rtl @@ -430,7 +432,6 @@ void TextLayoutCacheValue::computeValuesWithHarfbuzz(SkPaint* paint, const UChar #endif if (rc == 1 || !U_SUCCESS(status)) { - LOGD("HERE !!!"); computeRunValuesWithHarfbuzz(paint, chars, start, count, contextCount, dirFlags, outAdvances, outTotalAdvance, outGlyphs, outGlyphsCount); ubidi_close(bidi); @@ -517,16 +518,25 @@ void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(SkPaint* paint, const UC #endif // Get Advances and their total - jfloat totalAdvance = 0; - for (size_t i = 0; i < count; i++) { - totalAdvance += outAdvances[i] = HBFixedToFloat(shaperItem.advances[i]); -#if DEBUG_ADVANCES - LOGD("hb-adv = %d - rebased = %f - total = %f", shaperItem.advances[i], outAdvances[i], - totalAdvance); -#endif + jfloat totalAdvance = outAdvances[0] = HBFixedToFloat(shaperItem.advances[shaperItem.log_clusters[0]]); + for (size_t i = 1; i < count; i++) { + size_t clusterPrevious = shaperItem.log_clusters[i - 1]; + size_t cluster = shaperItem.log_clusters[i]; + if (cluster == clusterPrevious) { + outAdvances[i] = 0; + } else { + totalAdvance += outAdvances[i] = HBFixedToFloat(shaperItem.advances[shaperItem.log_clusters[i]]); + } } *outTotalAdvance = totalAdvance; +#if DEBUG_ADVANCES + for (size_t i = 0; i < count; i++) { + LOGD("hb-adv[%d] = %f - log_clusters = %d - total = %f", i, + outAdvances[i], shaperItem.log_clusters[i], totalAdvance); + } +#endif + // Get Glyphs if (outGlyphs) { *outGlyphsCount = shaperItem.num_glyphs; |