From 324133141121953a2bad19b6734401dd52d83726 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 15 Aug 2011 11:16:09 +0300 Subject: Support RLE/RLO/LRE/LRO for determining paragraph direction. src/bidi.c (bidi_paragraph_init): Support zero value of bidi_ignore_explicit_marks_for_paragraph_level. --- src/bidi.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/bidi.c') diff --git a/src/bidi.c b/src/bidi.c index 2879198ce31..383553f6d91 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -79,6 +79,11 @@ typedef enum { STRONG } bidi_category_t; +/* UAX#9 says to search only for L, AL, or R types of characters, and + ignore RLE, RLO, LRE, and LRO, when determining the base paragraph + level. Yudit indeed ignores them. This variable is therefore set + by default to ignore them, but setting it to zero will take them + into account. */ extern int bidi_ignore_explicit_marks_for_paragraph_level EXTERNALLY_VISIBLE; int bidi_ignore_explicit_marks_for_paragraph_level = 1; @@ -1178,10 +1183,6 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) type = bidi_get_type (ch, NEUTRAL_DIR); for (pos += nchars, bytepos += ch_len; - /* NOTE: UAX#9 says to search only for L, AL, or R types - of characters, and ignore RLE, RLO, LRE, and LRO. - However, I'm not sure it makes sense to omit those 4; - should try with and without that to see the effect. */ (bidi_get_category (type) != STRONG) || (bidi_ignore_explicit_marks_for_paragraph_level && (type == RLE || type == RLO @@ -1206,9 +1207,13 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) pos += nchars; bytepos += ch_len; } - if (type == STRONG_R || type == STRONG_AL) /* P3 */ + if ((type == STRONG_R || type == STRONG_AL) /* P3 */ + || (!bidi_ignore_explicit_marks_for_paragraph_level + && (type == RLO || type == RLE))) bidi_it->paragraph_dir = R2L; - else if (type == STRONG_L) + else if (type == STRONG_L + || (!bidi_ignore_explicit_marks_for_paragraph_level + && (type == LRO || type == LRE))) bidi_it->paragraph_dir = L2R; if (!string_p && no_default_p && bidi_it->paragraph_dir == NEUTRAL_DIR) -- cgit v1.2.1 From 474a84653b4aa5a10b49af751c3008a4c582422c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 15 Aug 2011 20:47:25 +0300 Subject: Use uniprop tables instead of biditype.h and bidimirror.h. src/bidi.c (bidi_initialize): Use uniprop_table instead of including biditype.h and bidimirror.h. src/biditype.h: File removed. src/bidimirror.h: File removed. src/deps.mk (bidi.o): Remove biditype.h and bidimirror.h. src/makefile.w32-in ($(BLD)/bidi.$(O)): Remove biditype.h and bidimirror.h. src/dispextern.h: Fix a typo in the comment to bidi_type_t. src/chartab.c: Improve commentary for the uniprop_table API. admin/unidata/bidimirror.awk: File removed. admin/unidata/biditype.awk: File removed. admin/unidata/makefile.w32-in (all): Remove src/biditype.h and src/bidimirror.h. (../../src/biditype.h, ../../src/bidimirror.h): Deleted. admin/unidata/Makefile.in (all): Remove src/biditype.h and src/bidimirror.h. (../../src/biditype.h, ../../src/bidimirror.h): Deleted. --- src/bidi.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/bidi.c') diff --git a/src/bidi.c b/src/bidi.c index 383553f6d91..280c9d15769 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -746,26 +746,18 @@ bidi_unshelve_cache (void *databuf, int just_free) static void bidi_initialize (void) { - -#include "biditype.h" -#include "bidimirror.h" - int i; - bidi_type_table = Fmake_char_table (Qnil, make_number (STRONG_L)); + bidi_type_table = uniprop_table (intern ("bidi-class")); + if (NILP (bidi_type_table)) + abort (); staticpro (&bidi_type_table); - for (i = 0; i < sizeof bidi_type / sizeof bidi_type[0]; i++) - char_table_set_range (bidi_type_table, bidi_type[i].from, bidi_type[i].to, - make_number (bidi_type[i].type)); - - bidi_mirror_table = Fmake_char_table (Qnil, Qnil); + bidi_mirror_table = uniprop_table (intern ("mirroring")); + if (NILP (bidi_mirror_table)) + abort (); staticpro (&bidi_mirror_table); - for (i = 0; i < sizeof bidi_mirror / sizeof bidi_mirror[0]; i++) - char_table_set (bidi_mirror_table, bidi_mirror[i].from, - make_number (bidi_mirror[i].to)); - Qparagraph_start = intern ("paragraph-start"); staticpro (&Qparagraph_start); paragraph_start_re = Fsymbol_value (Qparagraph_start); -- cgit v1.2.1 From 3ebec5517ea32d0c9d1954f0ea806b4fb256f12e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 15 Aug 2011 11:54:18 -0700 Subject: * bidi.c (bidi_initialize): Remove unused local. --- src/bidi.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/bidi.c') diff --git a/src/bidi.c b/src/bidi.c index 280c9d15769..c0eee33ab3f 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -746,8 +746,6 @@ bidi_unshelve_cache (void *databuf, int just_free) static void bidi_initialize (void) { - int i; - bidi_type_table = uniprop_table (intern ("bidi-class")); if (NILP (bidi_type_table)) abort (); -- cgit v1.2.1