aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-10-06 19:08:21 +0300
committerEli Zaretskii2015-10-06 19:08:21 +0300
commite2b1ad428c10b012abaa72749976732f7b584bbd (patch)
tree5427c90bfc7d6731aae1d2d9d9bf4fb0b17b4b59 /src
parent0befeb0b7f7492103aa3902146a891fbef9e7d21 (diff)
downloademacs-e2b1ad428c10b012abaa72749976732f7b584bbd.tar.gz
emacs-e2b1ad428c10b012abaa72749976732f7b584bbd.zip
Fix display of characters adjacent to ZWJ and ZWNJ
* src/bidi.c (bidi_resolve_neutral): Treat all Bn (a.k.a. "control") characters the same as directional formatting controls. (bidi_level_of_next_char): Include all Bn characters in rule L1, as mandated by the UBA.
Diffstat (limited to 'src')
-rw-r--r--src/bidi.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/bidi.c b/src/bidi.c
index 9427b81298f..e3b1f549685 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -2948,7 +2948,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
2948 we are already at paragraph end. */ 2948 we are already at paragraph end. */
2949 && (is_neutral || bidi_isolate_fmt_char (type))) 2949 && (is_neutral || bidi_isolate_fmt_char (type)))
2950 /* N1-N2/Retaining */ 2950 /* N1-N2/Retaining */
2951 || (type == WEAK_BN && bidi_explicit_dir_char (bidi_it->ch))) 2951 || type == WEAK_BN)
2952 { 2952 {
2953 if (bidi_it->next_for_neutral.type != UNKNOWN_BT) 2953 if (bidi_it->next_for_neutral.type != UNKNOWN_BT)
2954 { 2954 {
@@ -2978,6 +2978,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
2978 entering the expensive loop in the "else" clause. */ 2978 entering the expensive loop in the "else" clause. */
2979 else if (current_level == 0 2979 else if (current_level == 0
2980 && bidi_it->prev_for_neutral.type == STRONG_L 2980 && bidi_it->prev_for_neutral.type == STRONG_L
2981 && type != WEAK_BN
2981 && !bidi_explicit_dir_char (bidi_it->ch) 2982 && !bidi_explicit_dir_char (bidi_it->ch)
2982 && !bidi_isolate_fmt_char (type)) 2983 && !bidi_isolate_fmt_char (type))
2983 type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type, 2984 type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type,
@@ -2991,6 +2992,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
2991 && (bidi_it->prev_for_neutral.type == STRONG_R 2992 && (bidi_it->prev_for_neutral.type == STRONG_R
2992 || bidi_it->prev_for_neutral.type == WEAK_EN 2993 || bidi_it->prev_for_neutral.type == WEAK_EN
2993 || bidi_it->prev_for_neutral.type == WEAK_AN) 2994 || bidi_it->prev_for_neutral.type == WEAK_AN)
2995 && type != WEAK_BN
2994 && !bidi_explicit_dir_char (bidi_it->ch) 2996 && !bidi_explicit_dir_char (bidi_it->ch)
2995 && !bidi_isolate_fmt_char (type)) 2997 && !bidi_isolate_fmt_char (type))
2996 type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type, 2998 type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type,
@@ -3216,6 +3218,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
3216 it belongs to a sequence of WS characters preceding a newline 3218 it belongs to a sequence of WS characters preceding a newline
3217 or a TAB or a paragraph separator. */ 3219 or a TAB or a paragraph separator. */
3218 if ((bidi_it->orig_type == NEUTRAL_WS 3220 if ((bidi_it->orig_type == NEUTRAL_WS
3221 || bidi_it->orig_type == WEAK_BN
3219 || bidi_isolate_fmt_char (bidi_it->orig_type)) 3222 || bidi_isolate_fmt_char (bidi_it->orig_type))
3220 && bidi_it->next_for_ws.charpos < bidi_it->charpos) 3223 && bidi_it->next_for_ws.charpos < bidi_it->charpos)
3221 { 3224 {
@@ -3249,11 +3252,14 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
3249 3252
3250 /* Resolve implicit levels. */ 3253 /* Resolve implicit levels. */
3251 if (bidi_it->orig_type == NEUTRAL_B /* L1 */ 3254 if (bidi_it->orig_type == NEUTRAL_B /* L1 */
3252 || bidi_it->orig_type == NEUTRAL_S 3255 || bidi_it->orig_type == NEUTRAL_S
3253 || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB 3256 || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB
3254 || (bidi_it->orig_type == NEUTRAL_WS 3257 || ((bidi_it->orig_type == NEUTRAL_WS
3255 && (bidi_it->next_for_ws.type == NEUTRAL_B 3258 || bidi_it->orig_type == WEAK_BN
3256 || bidi_it->next_for_ws.type == NEUTRAL_S))) 3259 || bidi_isolate_fmt_char (bidi_it->orig_type)
3260 || bidi_explicit_dir_char (bidi_it->ch))
3261 && (bidi_it->next_for_ws.type == NEUTRAL_B
3262 || bidi_it->next_for_ws.type == NEUTRAL_S)))
3257 level = bidi_it->level_stack[0].level; 3263 level = bidi_it->level_stack[0].level;
3258 else if ((level & 1) == 0) /* I1 */ 3264 else if ((level & 1) == 0) /* I1 */
3259 { 3265 {