Leave the extended Arabic letters unshaped, as ICU does

This commit is contained in:
Kacpherek
2026-10-26 23:12:44 +01:00
parent 26aef75d7c
commit 8a5d7bb78d
+3 -7
View File
@@ -60,6 +60,8 @@ const JOINS: &[(u32, u32, Join)] = &[
/// Letters that have joined forms and the code point of the isolated one; the
/// final, initial and medial forms follow it (a right-joining letter has the
/// isolated and final only). The lam-alef ligatures are their own letters.
/// ICU leaves the extended letters (پ چ ژ ک گ ی and the rest of U+0679 to
/// U+06D3) unchanged, so they are in `JOINS` but not here.
#[rustfmt::skip]
const FORMS: &[(u32, u32)] = &[
(0x0622, 0xFE81), (0x0623, 0xFE83), (0x0624, 0xFE85), (0x0625, 0xFE87), (0x0626, 0xFE89),
@@ -69,12 +71,6 @@ const FORMS: &[(u32, u32)] = &[
(0x0636, 0xFEBD), (0x0637, 0xFEC1), (0x0638, 0xFEC5), (0x0639, 0xFEC9), (0x063A, 0xFECD),
(0x0641, 0xFED1), (0x0642, 0xFED5), (0x0643, 0xFED9), (0x0644, 0xFEDD), (0x0645, 0xFEE1),
(0x0646, 0xFEE5), (0x0647, 0xFEE9), (0x0648, 0xFEED), (0x0649, 0xFEEF), (0x064A, 0xFEF1),
(0x0679, 0xFB66), (0x067A, 0xFB5E), (0x067B, 0xFB52), (0x067E, 0xFB56), (0x0686, 0xFB7A),
(0x0688, 0xFB88), (0x068C, 0xFB84), (0x068D, 0xFB82), (0x068E, 0xFB86), (0x0691, 0xFB8C),
(0x0698, 0xFB8A), (0x06A9, 0xFB8E), (0x06AF, 0xFB92), (0x06BA, 0xFB9E), (0x06BB, 0xFBA0),
(0x06BE, 0xFBAA), (0x06C0, 0xFBA4), (0x06C1, 0xFBA6), (0x06C5, 0xFBE0), (0x06C6, 0xFBD9),
(0x06C7, 0xFBD7), (0x06C8, 0xFBDB), (0x06C9, 0xFBE2), (0x06CB, 0xFBDE), (0x06CC, 0xFBFC),
(0x06D0, 0xFBE4), (0x06D2, 0xFBAE), (0x06D3, 0xFBB0), (0xFEF5, 0xFEF5), (0xFEF7, 0xFEF7),
(0xFEF9, 0xFEF9), (0xFEFB, 0xFEFB),
];
@@ -102,7 +98,7 @@ fn join(c: char) -> Join {
/// The letter whose joined form `c` is (ICU shapes the forms again), or `c`.
fn letter_of(c: char) -> char {
let c32 = c as u32;
if !matches!(c32, 0xFB50..=0xFDFF | 0xFE70..=0xFEFC) {
if !matches!(c32, 0xFE70..=0xFEFC) {
return c;
}
if (0xFE70..0xFE80).contains(&c32) {