From fae80c8290b8bb1f1a11e429a47e80248eaf3072 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 4 Jan 2013 19:47:24 -0600 Subject: Fix bug with rule W5 Test case added. This was discovered by running against the Unicode test suite. https://github.com/behdad/fribidi-vs-unicode --- lib/fribidi-bidi.c | 6 +++++- test/test_CapRTL_implicit.input | 1 + test/test_CapRTL_implicit.reference | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/fribidi-bidi.c b/lib/fribidi-bidi.c index 42a5fab..6e67d57 100644 --- a/lib/fribidi-bidi.c +++ b/lib/fribidi-bidi.c @@ -546,6 +546,10 @@ fribidi_get_par_embedding_levels ( pp = merge_with_prev (pp); else RL_TYPE (pp) = prev_type; + if (prev_type == next_type && RL_LEVEL (pp) == RL_LEVEL (pp->next)) + { + pp = merge_with_prev (pp->next); + } continue; /* As we know the next condition cannot be true. */ } @@ -564,7 +568,7 @@ fribidi_get_par_embedding_levels ( last_strong = base_dir; /* Resolving dependency of loops for rules W4 and W5, W5 may - want to prevent W4 to take effect in the next turn, do this + want to prevent W4 to take effect in the next turn, do this through "w4". */ w4 = true; /* Resolving dependency of loops for rules W4 and W5 with W7, diff --git a/test/test_CapRTL_implicit.input b/test/test_CapRTL_implicit.input index cd5fadf..ef6a3d5 100644 --- a/test/test_CapRTL_implicit.input +++ b/test/test_CapRTL_implicit.input @@ -24,3 +24,4 @@ A TEST FOR WEAK TYPES: 123+,456 ANOTHER FOR WEAK TYPES: A123,456 MORE WEAK TYPES: hooloo123,456 and TEST|L1 ||too +_<+`+1 diff --git a/test/test_CapRTL_implicit.reference b/test/test_CapRTL_implicit.reference index 6ef244a..e324a7e 100644 --- a/test/test_CapRTL_implicit.reference +++ b/test/test_CapRTL_implicit.reference @@ -24,3 +24,4 @@ A TEST FOR WEAK TYPES: 123+,456 => 456,123+ :SEPYT KAEW ROF TSET A ANOTHER FOR WEAK TYPES: A123,456 => 123,456A :SEPYT KAEW ROF REHTONA MORE WEAK TYPES: hooloo123,456 => hooloo123,456 :SEPYT KAEW EROM and TEST|L1 ||too => and TSET|1L ||too +_<+`+1 => +`+1 -- cgit v1.2.3