diff options
author | Raph Levien <raph@google.com> | 2013-04-23 12:42:16 -0700 |
---|---|---|
committer | Raph Levien <raph@google.com> | 2013-04-23 12:51:27 -0700 |
commit | 9d47db23ff0f943dd959a9a8501563b6975c4781 (patch) | |
tree | 677398e1186ea559b86e68c1eba4ae22b9a0a562 /core/jni | |
parent | 339ac85483145972da010ad34cbcb29ed70cb822 (diff) | |
download | frameworks_base-9d47db23ff0f943dd959a9a8501563b6975c4781.zip frameworks_base-9d47db23ff0f943dd959a9a8501563b6975c4781.tar.gz frameworks_base-9d47db23ff0f943dd959a9a8501563b6975c4781.tar.bz2 |
Fix for bug 8695466 GPOS combining mark positioning broken before space
This patch makes segmentation into script runs behave the same in RTL
as in LTR modes - so that inherited script characters are always
associated with the preceding run. Otherwise, for a sequence such as
u+0631 u+064d u+0020, it would get split after the first character,
which would lose the ability to correctly position the u+064d mark.
Change-Id: I3c12ba1b77d18334f55e707f518be1046e6b339b
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android/graphics/TextLayoutCache.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 17f205d..bcc1573 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -622,11 +622,11 @@ hb_utf16_script_run_prev(ScriptRun* run, const uint16_t *chars, size_t len, ssiz const hb_script_t init_script = code_point_to_script(init_cp); hb_script_t current_script = init_script; run->script = init_script; + size_t break_iter = *iter; for (;;) { if (*iter < 0) break; - const ssize_t prev_iter = *iter; const uint32_t cp = utf16_to_code_point_prev(chars, len, iter); const hb_script_t script = code_point_to_script(cp); @@ -635,21 +635,18 @@ hb_utf16_script_run_prev(ScriptRun* run, const uint16_t *chars, size_t len, ssiz // If we started off as inherited, we take whatever we can find. run->script = script; current_script = script; + // In cases of script1 + inherited + script2, always group the inherited + // with script1. + break_iter = *iter; continue; } else if (script == HB_SCRIPT_INHERITED) { - /* BEGIN android-changed - We apply the same fix for Chrome to Android. - Chrome team will talk with upsteam about it. - Just assume that whatever follows this combining character is within - the same script. This is incorrect if you had language1 + combining - char + language 2, but that is rare and this code is suspicious - anyway. - END android-changed */ continue; } else { - *iter = prev_iter; + *iter = break_iter; break; } + } else { + break_iter = *iter; } } |