1use super::arabic::JoiningType::{self, GroupAlaph as A, GroupDalathRish as DR, D, L, R, T, U, X};
2
3#[rustfmt::skip]
4pub const JOINING_TABLE: &[JoiningType] = &[
5 /* Arabic */
6
7 /* 0600 */ U,U,U,U,U,U,X,X,U,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
8 /* 0620 */ D,U,R,R,R,R,D,R,D,R,D,D,D,D,D,R,R,R,R,D,D,D,D,D,D,D,D,D,D,D,D,D,
9 /* 0640 */ D,D,D,D,D,D,D,D,R,D,D,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
10 /* 0660 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,D,D,X,R,R,R,U,R,R,R,D,D,D,D,D,D,D,D,
11 /* 0680 */ D,D,D,D,D,D,D,D,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,D,D,D,D,D,D,
12 /* 06A0 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
13 /* 06C0 */ R,D,D,R,R,R,R,R,R,R,R,R,D,R,D,R,D,D,R,R,X,R,X,X,X,X,X,X,X,U,X,X,
14 /* 06E0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,R,R,X,X,X,X,X,X,X,X,X,X,D,D,D,X,X,D,
15
16 /* Syriac */
17
18 /* 0700 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,T,A,X,D,D,D,DR,DR,R,R,R,D,D,D,D,R,D,
19 /* 0720 */ D,D,D,D,D,D,D,D,R,D,DR,D,R,D,D,DR,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
20 /* 0740 */ X,X,X,X,X,X,X,X,X,X,X,X,X,R,D,D,
21
22 /* Arabic Supplement */
23
24 /* 0740 */ D,D,D,D,D,D,D,D,D,R,R,R,D,D,D,D,
25 /* 0760 */ D,D,D,D,D,D,D,D,D,D,D,R,R,D,D,D,D,R,D,R,R,D,D,D,R,R,D,D,D,D,D,D,
26
27 /* FILLER */
28
29 /* 0780 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
30 /* 07A0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
31
32 /* NKo */
33
34 /* 07C0 */ X,X,X,X,X,X,X,X,X,X,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
35 /* 07E0 */ D,D,D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,D,X,X,X,X,X,
36
37 /* FILLER */
38
39 /* 0800 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
40 /* 0820 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
41
42 /* Mandaic */
43
44 /* 0840 */ R,D,D,D,D,D,R,R,D,R,D,D,D,D,D,D,D,D,D,D,R,D,U,U,U,X,X,X,X,X,X,X,
45
46 /* Syriac Supplement */
47
48 /* 0860 */ D,U,D,D,D,D,U,R,D,R,R,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
49 /* 0880 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
50
51 /* Arabic Extended-A */
52
53 /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,X,D,D,D,R,D,D,D,D,X,X,
54 /* 08C0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
55 /* 08E0 */ X,X,U,
56
57 /* Mongolian */
58
59 /* 1800 */ U,D,X,X,D,X,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
60 /* 1820 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
61 /* 1840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
62 /* 1860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X,
63 /* 1880 */ U,U,U,U,U,T,T,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
64 /* 18A0 */ D,D,D,D,D,D,D,D,D,X,D,
65
66 /* General Punctuation */
67
68 /* 2000 */ U,D,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
69 /* 2020 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
70 /* 2040 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
71 /* 2060 */ X,X,X,X,X,X,U,U,U,U,
72
73 /* Phags-pa */
74
75 /* A840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
76 /* A860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,L,U,
77
78 /* Manichaean */
79
80 /* 10AC0 */ D,D,D,D,D,R,U,R,U,R,R,U,U,L,R,R,R,R,R,D,D,D,D,L,D,D,D,D,D,R,D,D,
81 /* 10AE0 */ D,R,U,U,R,X,X,X,X,X,X,D,D,D,D,R,
82
83 /* Psalter Pahlavi */
84
85 /* 10B80 */ D,R,D,R,R,R,D,D,D,R,D,D,R,D,R,R,D,R,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
86 /* 10BA0 */ X,X,X,X,X,X,X,X,X,R,R,R,R,D,D,U,
87
88 /* Hanifi Rohingya */
89
90 /* 10D00 */ L,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
91 /* 10D20 */ D,D,R,D,
92
93 /* Sogdian */
94
95 /* 10F20 */ D,D,D,R,D,D,D,D,D,D,D,D,D,D,D,D,
96 /* 10F40 */ D,D,D,D,D,U,X,X,X,X,X,X,X,X,X,X,X,D,D,D,R,
97
98 /* Kaithi */
99
100 /* 110A0 */ U,X,X,
101 /* 110C0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,U,
102
103 /* Adlam */
104
105 /* 1E900 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
106 /* 1E920 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
107 /* 1E940 */ D,D,D,D,X,X,X,X,X,X,X,T,
108];
109
110const JOINING_OFFSET_0X0600: usize = 0;
111const JOINING_OFFSET_0X1806: usize = 739;
112const JOINING_OFFSET_0X200C: usize = 904;
113const JOINING_OFFSET_0XA840: usize = 998;
114const JOINING_OFFSET_0X10AC0: usize = 1050;
115const JOINING_OFFSET_0X10B80: usize = 1098;
116const JOINING_OFFSET_0X10D00: usize = 1146;
117const JOINING_OFFSET_0X10F30: usize = 1182;
118const JOINING_OFFSET_0X110BD: usize = 1219;
119const JOINING_OFFSET_0X1E900: usize = 1236;
120
121pub fn joining_type(u: char) -> JoiningType {
122 let u = u as u32;
123 match u >> 12 {
124 0x0 => {
125 if (0x0600..=0x08E2).contains(&u) {
126 return JOINING_TABLE[u as usize - 0x0600 + JOINING_OFFSET_0X0600];
127 }
128 }
129 0x1 => {
130 if (0x1806..=0x18AA).contains(&u) {
131 return JOINING_TABLE[u as usize - 0x1806 + JOINING_OFFSET_0X1806];
132 }
133 }
134 0x2 => {
135 if (0x200C..=0x2069).contains(&u) {
136 return JOINING_TABLE[u as usize - 0x200C + JOINING_OFFSET_0X200C];
137 }
138 }
139 0xA => {
140 if (0xA840..=0xA873).contains(&u) {
141 return JOINING_TABLE[u as usize - 0xA840 + JOINING_OFFSET_0XA840];
142 }
143 }
144 0x10 => {
145 if (0x10AC0..=0x10AEF).contains(&u) {
146 return JOINING_TABLE[u as usize - 0x10AC0 + JOINING_OFFSET_0X10AC0];
147 }
148 if (0x10B80..=0x10BAF).contains(&u) {
149 return JOINING_TABLE[u as usize - 0x10B80 + JOINING_OFFSET_0X10B80];
150 }
151 if (0x10D00..=0x10D23).contains(&u) {
152 return JOINING_TABLE[u as usize - 0x10D00 + JOINING_OFFSET_0X10D00];
153 }
154 if (0x10F30..=0x10F54).contains(&u) {
155 return JOINING_TABLE[u as usize - 0x10F30 + JOINING_OFFSET_0X10F30];
156 }
157 }
158 0x11 => {
159 if (0x110BD..=0x110CD).contains(&u) {
160 return JOINING_TABLE[u as usize - 0x110BD + JOINING_OFFSET_0X110BD];
161 }
162 }
163 0x1E => {
164 if (0x1E900..=0x1E94B).contains(&u) {
165 return JOINING_TABLE[u as usize - 0x1E900 + JOINING_OFFSET_0X1E900];
166 }
167 }
168 _ => {}
169 }
170
171 X
172}
173