1 Sep 10:26
API for bidi reordering a string
Eli Zaretskii <eliz <at> gnu.org>
2010-09-01 08:26:11 GMT
2010-09-01 08:26:11 GMT
I'm planning on implementing the following API for reordering a logical-order string into visual order. Comments are welcome, especially regarding the way the extra information is returned. (defun bidi-reorder-string string embedding &optional extra) "Reorder the input STRING from logical to visual order. This function reorders STRING according to the Unicode Bidirectional Algorithm described in the Unicode Standard Annex #9 (UAX#9), see http://unicode.org/reports/tr9/. Second argument EMBEDDING provides the base paragraph embedding level for the reordering. It is `left-to-right' for left-to-right paragraphs, `right-to-left' for right-to-left paragraphs, or nil for neutral paragraphs. In the latter case, the actual base paragraph level is determined from the string itself, using the UAX#9 rules. Value is the reordered string. For STRING without any characters from right-to-left scripts, such as Arabic or Hebrew, this function returns a copy of the original STRING, possibly with a text property \(see below). Optional argument EXTRA non-nil means return additional information about the results of reordering. This information is recorded in the value of the `bidi-info' text property of the returned string. The value is a vector of the form: [EMBEDDING LOG-TO-VIS VIS-TO-LOG LEVELS] EMBEDDING is the actual base paragraph embedding level. It is(Continue reading)
RSS Feed