bidi: Expand+Correct the list of RTL codepoints in is_rtl_char()

Was missing:

 * Arabic Supplement
 * Arabic Extended B
 * Arabic Extended A
 * Rumi Numerals
 * Arabic Extended C
 * Indic Isqaq Numerals
 * Ottoman Siyaq Numerals
 * Arabic Mathematical Alphabet Symbols

Worth noting that most of these are vanishingly unlikely to ever show up
in the context of Rockbox.  (The exceptions are "Arabic Supplement" and
possibly the Mathematical Symbols)

Also corrected "Arabic Presentation" into two distint blocks, as
the characters between them (fe00-fe6f) are NOT indicative of RTL.

Change-Id: I0c5c547921c789d32425682c8c75edb21428f549
This commit is contained in:
Solomon Peachy 2026-06-27 10:06:51 -04:00
parent 0e3355de50
commit 5462f203d3

View file

@ -25,8 +25,22 @@
/* True for code points that belong to a right-to-left script (Hebrew, Arabic
* and the Arabic presentation forms). Shared by the bidi engine and by callers
* that need to know a string's direction. */
#define is_rtl_char(c) (((c) > 0x0589 && (c) < 0x0700) || \
((c) >= 0xfb50 && (c) <= 0xfefc))
static inline bool is_rtl_char(ucschar_t c)
{
return ((c >= 0x0590 && c <= 0x06ff) /* Hebrew + Arabic */ ||
(c >= 0x0750 && c <= 0x077f) /* Arabic Supp */ ||
(c >= 0x0870 && c <= 0x08ff) /* Arabic Ext B+A */ ||
(c >= 0xfb50 && c <= 0xfdff) /* Arabic Pres A */ ||
(c >= 0xfe70 && c <= 0xfefc) /* Arabic Pres B */
#ifdef UNICODE32
|| (c >= 0x10e60 && c <= 0x107ef) /* Rumi Numerals */
|| (c >= 0x10ec0 && c <= 0x10eff) /* Arabic Ext C */
|| (c >= 0x1ec70 && c <= 0x1ecbf) /* Indic Siyaq Numerals */
|| (c >= 0x1ed00 && c <= 0x1ed4f) /* Ottoman Siyaq Numerals */
|| (c >= 0x1ee00 && c <= 0x1eeff) /* Arabic Mathenatical Symbols */
#endif
);
}
/* True if the string's first strongly-directional character is RTL, i.e. the
* string should be laid out right-to-left. */