-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathot_vowels_constraints.go
323 lines (301 loc) · 7.29 KB
/
ot_vowels_constraints.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
package harfbuzz
import "github.com/benoitkugler/textlayout/language"
// Code generated by unicodedata/generate/main.go DO NOT EDIT.
func outputDottedCircle(buffer *Buffer) {
buffer.outputRune(0x25CC)
buffer.prev().resetContinutation()
}
func outputWithDottedCircle(buffer *Buffer) {
outputDottedCircle(buffer)
buffer.nextGlyph()
}
func preprocessTextVowelConstraints(buffer *Buffer) {
if (buffer.Flags & DoNotinsertDottedCircle) != 0 {
return
}
/* UGLY UGLY UGLY business of adding dotted-circle in the middle of
* vowel-sequences that look like another vowel. Data for each script
* collected from the USE script development spec.
*
* https://github.com/harfbuzz/harfbuzz/issues/1019
*/
buffer.clearOutput()
count := len(buffer.Info)
switch buffer.Props.Script {
case language.Devanagari:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0905:
switch buffer.cur(1).codepoint {
case 0x093A, 0x093B, 0x093E, 0x0945, 0x0946, 0x0949, 0x094A, 0x094B, 0x094C, 0x094F, 0x0956, 0x0957:
matched = true
}
case 0x0906:
switch buffer.cur(1).codepoint {
case 0x093A, 0x0945, 0x0946, 0x0947, 0x0948:
matched = true
}
case 0x0909:
matched = 0x0941 == buffer.cur(1).codepoint
case 0x090F:
switch buffer.cur(1).codepoint {
case 0x0945, 0x0946, 0x0947:
matched = true
}
case 0x0930:
if 0x094D == buffer.cur(1).codepoint &&
buffer.idx+2 < count &&
0x0907 == buffer.cur(2).codepoint {
buffer.nextGlyph()
matched = true
}
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Bengali:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0985:
matched = 0x09BE == buffer.cur(1).codepoint
case 0x098B:
matched = 0x09C3 == buffer.cur(1).codepoint
case 0x098C:
matched = 0x09E2 == buffer.cur(1).codepoint
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Gurmukhi:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0A05:
switch buffer.cur(1).codepoint {
case 0x0A3E, 0x0A48, 0x0A4C:
matched = true
}
case 0x0A72:
switch buffer.cur(1).codepoint {
case 0x0A3F, 0x0A40, 0x0A47:
matched = true
}
case 0x0A73:
switch buffer.cur(1).codepoint {
case 0x0A41, 0x0A42, 0x0A4B:
matched = true
}
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Gujarati:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0A85:
switch buffer.cur(1).codepoint {
case 0x0ABE, 0x0AC5, 0x0AC7, 0x0AC8, 0x0AC9, 0x0ACB, 0x0ACC:
matched = true
}
case 0x0AC5:
matched = 0x0ABE == buffer.cur(1).codepoint
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Oriya:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0B05:
matched = 0x0B3E == buffer.cur(1).codepoint
case 0x0B0F, 0x0B13:
matched = 0x0B57 == buffer.cur(1).codepoint
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Tamil:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
if 0x0B85 == buffer.cur(0).codepoint &&
0x0BC2 == buffer.cur(1).codepoint {
matched = true
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Telugu:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0C12:
switch buffer.cur(1).codepoint {
case 0x0C4C, 0x0C55:
matched = true
}
case 0x0C3F, 0x0C46, 0x0C4A:
matched = 0x0C55 == buffer.cur(1).codepoint
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Kannada:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0C89, 0x0C8B:
matched = 0x0CBE == buffer.cur(1).codepoint
case 0x0C92:
matched = 0x0CCC == buffer.cur(1).codepoint
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Malayalam:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0D07, 0x0D09:
matched = 0x0D57 == buffer.cur(1).codepoint
case 0x0D0E:
matched = 0x0D46 == buffer.cur(1).codepoint
case 0x0D12:
switch buffer.cur(1).codepoint {
case 0x0D3E, 0x0D57:
matched = true
}
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Sinhala:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x0D85:
switch buffer.cur(1).codepoint {
case 0x0DCF, 0x0DD0, 0x0DD1:
matched = true
}
case 0x0D8B, 0x0D8F, 0x0D94:
matched = 0x0DDF == buffer.cur(1).codepoint
case 0x0D8D:
matched = 0x0DD8 == buffer.cur(1).codepoint
case 0x0D91:
switch buffer.cur(1).codepoint {
case 0x0DCA, 0x0DD9, 0x0DDA, 0x0DDC, 0x0DDD, 0x0DDE:
matched = true
}
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Brahmi:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x11005:
matched = 0x11038 == buffer.cur(1).codepoint
case 0x1100B:
matched = 0x1103E == buffer.cur(1).codepoint
case 0x1100F:
matched = 0x11042 == buffer.cur(1).codepoint
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Khudawadi:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x112B0:
switch buffer.cur(1).codepoint {
case 0x112E0, 0x112E5, 0x112E6, 0x112E7, 0x112E8:
matched = true
}
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Tirhuta:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x11481:
matched = 0x114B0 == buffer.cur(1).codepoint
case 0x1148B, 0x1148D:
matched = 0x114BA == buffer.cur(1).codepoint
case 0x114AA:
switch buffer.cur(1).codepoint {
case 0x114B5, 0x114B6:
matched = true
}
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Modi:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x11600, 0x11601:
switch buffer.cur(1).codepoint {
case 0x11639, 0x1163A:
matched = true
}
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
case language.Takri:
for buffer.idx = 0; buffer.idx+1 < count; {
matched := false
switch buffer.cur(0).codepoint {
case 0x11680:
switch buffer.cur(1).codepoint {
case 0x116AD, 0x116B4, 0x116B5:
matched = true
}
case 0x11686:
matched = 0x116B2 == buffer.cur(1).codepoint
}
buffer.nextGlyph()
if matched {
outputWithDottedCircle(buffer)
}
}
}
buffer.swapBuffers()
}