@mark1russell7/typeset 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bidi.d.ts +50 -0
- package/build/bidi.d.ts.map +1 -0
- package/build/bidi.js +41 -0
- package/build/bidi.js.map +1 -0
- package/build/chunks/font.js +37 -71
- package/build/chunks/font.js.map +1 -1
- package/build/chunks/resolve.js +382 -0
- package/build/chunks/resolve.js.map +1 -0
- package/build/segmentation.d.ts +30 -5
- package/build/segmentation.d.ts.map +1 -1
- package/build/segmentation.js +87 -11
- package/build/segmentation.js.map +1 -1
- package/package.json +6 -2
- package/src/bidi/brackets.ts +23 -0
- package/src/bidi/classes.ts +43 -0
- package/src/bidi/resolve.ts +380 -0
- package/src/bidi/table.ts +5 -0
- package/src/bidi.ts +4 -0
- package/src/fonts/bidi.ts +26 -86
- package/src/segmentation/line-table.ts +2 -2
- package/src/segmentation/line.ts +42 -8
- package/src/segmentation/segments.ts +47 -0
- package/src/segmentation.ts +2 -2
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rules of the Unicode Bidirectional Algorithm (UAX #9). This module works on bidi classes and has no table, so `./fonts`
|
|
3
|
+
* can use it with its own classes. The comments give the names of the rules. This module treats each paragraph as one line.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** A bidi class of UAX #9. */
|
|
7
|
+
export type BidiClass =
|
|
8
|
+
| "L"
|
|
9
|
+
| "R"
|
|
10
|
+
| "AL"
|
|
11
|
+
| "EN"
|
|
12
|
+
| "ES"
|
|
13
|
+
| "ET"
|
|
14
|
+
| "AN"
|
|
15
|
+
| "CS"
|
|
16
|
+
| "NSM"
|
|
17
|
+
| "BN"
|
|
18
|
+
| "B"
|
|
19
|
+
| "S"
|
|
20
|
+
| "WS"
|
|
21
|
+
| "ON"
|
|
22
|
+
| "LRE"
|
|
23
|
+
| "LRO"
|
|
24
|
+
| "RLE"
|
|
25
|
+
| "RLO"
|
|
26
|
+
| "PDF"
|
|
27
|
+
| "LRI"
|
|
28
|
+
| "RLI"
|
|
29
|
+
| "FSI"
|
|
30
|
+
| "PDI";
|
|
31
|
+
|
|
32
|
+
/** The paragraph direction: `0` is left to right, `1` is right to left, and `"auto"` applies the rules P2 and P3. */
|
|
33
|
+
export type ParagraphDirection = 0 | 1 | "auto";
|
|
34
|
+
|
|
35
|
+
/** One paragraph of a resolved text. */
|
|
36
|
+
export interface BidiParagraph {
|
|
37
|
+
/** The index of the first character. */
|
|
38
|
+
readonly start: number;
|
|
39
|
+
/** The index after the last character. */
|
|
40
|
+
readonly end: number;
|
|
41
|
+
/** The paragraph embedding level. */
|
|
42
|
+
readonly level: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The result of `resolveLevels`. */
|
|
46
|
+
export interface ResolvedBidi {
|
|
47
|
+
/** The level of each character. The value is `removed` for a character that the rule X9 removes. */
|
|
48
|
+
readonly levels: number[];
|
|
49
|
+
readonly paragraphs: readonly BidiParagraph[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** This value is the level of a character that the rule X9 removes. */
|
|
53
|
+
export const removed = -1;
|
|
54
|
+
|
|
55
|
+
const L = 1 << 0;
|
|
56
|
+
const R = 1 << 1;
|
|
57
|
+
const AL = 1 << 2;
|
|
58
|
+
const EN = 1 << 3;
|
|
59
|
+
const ES = 1 << 4;
|
|
60
|
+
const ET = 1 << 5;
|
|
61
|
+
const AN = 1 << 6;
|
|
62
|
+
const CS = 1 << 7;
|
|
63
|
+
const NSM = 1 << 8;
|
|
64
|
+
const BN = 1 << 9;
|
|
65
|
+
const B = 1 << 10;
|
|
66
|
+
const S = 1 << 11;
|
|
67
|
+
const WS = 1 << 12;
|
|
68
|
+
const ON = 1 << 13;
|
|
69
|
+
const LRE = 1 << 14;
|
|
70
|
+
const LRO = 1 << 15;
|
|
71
|
+
const RLE = 1 << 16;
|
|
72
|
+
const RLO = 1 << 17;
|
|
73
|
+
const PDF = 1 << 18;
|
|
74
|
+
const LRI = 1 << 19;
|
|
75
|
+
const RLI = 1 << 20;
|
|
76
|
+
const FSI = 1 << 21;
|
|
77
|
+
const PDI = 1 << 22;
|
|
78
|
+
|
|
79
|
+
const bits: Readonly<Record<BidiClass, number>> = { L, R, AL, EN, ES, ET, AN, CS, NSM, BN, B, S, WS, ON, LRE, LRO, RLE, RLO, PDF, LRI, RLI, FSI, PDI };
|
|
80
|
+
const isolates = LRI | RLI | FSI;
|
|
81
|
+
const neutrals = B | S | WS | ON | isolates | PDI;
|
|
82
|
+
const maxDepth = 125;
|
|
83
|
+
const maxBrackets = 63;
|
|
84
|
+
|
|
85
|
+
/** One entry of the directional status stack of the rule X1. */
|
|
86
|
+
interface Status {
|
|
87
|
+
readonly level: number;
|
|
88
|
+
readonly override: number;
|
|
89
|
+
readonly isolate: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** This function gives the direction of a type for the rules N0 to N2: numbers count as `R`, and a neutral gives 0. */
|
|
93
|
+
function strong(type: number): number {
|
|
94
|
+
if (type === L) return L;
|
|
95
|
+
return type & (R | EN | AN) ? R : 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** This function applies the rule BD9. It gives each isolate initiator the index of its PDI, or `end` when it has no PDI. */
|
|
99
|
+
function matchIsolates(original: Int32Array, start: number, end: number, match: Int32Array): void {
|
|
100
|
+
const open: number[] = [];
|
|
101
|
+
for (let i = start; i < end; i++) {
|
|
102
|
+
if (original[i]! & isolates) {
|
|
103
|
+
open.push(i);
|
|
104
|
+
match[i] = end;
|
|
105
|
+
} else if (original[i] === PDI && open.length > 0) {
|
|
106
|
+
match[open.pop()!] = i;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** This function applies the rules P2 and P3 to a range. It gives the level of the first strong character, or else 0. */
|
|
112
|
+
function firstStrong(original: Int32Array, start: number, end: number, match: Int32Array): number {
|
|
113
|
+
for (let i = start; i < end; i++) {
|
|
114
|
+
const type = original[i]!;
|
|
115
|
+
if (type === L) return 0;
|
|
116
|
+
if (type & (R | AL)) return 1;
|
|
117
|
+
if (type & isolates) i = match[i]!;
|
|
118
|
+
}
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** This function applies the rules X1 to X9. It sets `levels` and it changes `types` where an override applies. */
|
|
123
|
+
function resolveExplicit(original: Int32Array, types: Int32Array, match: Int32Array, levels: number[], start: number, end: number, paragraph: number): void {
|
|
124
|
+
const stack: Status[] = [{ level: paragraph, override: 0, isolate: false }];
|
|
125
|
+
let overflowIsolates = 0;
|
|
126
|
+
let overflowEmbeddings = 0;
|
|
127
|
+
let validIsolates = 0;
|
|
128
|
+
for (let i = start; i < end; i++) {
|
|
129
|
+
const type = original[i]!;
|
|
130
|
+
let top = stack.at(-1)!;
|
|
131
|
+
if (type & (RLE | LRE | RLO | LRO | isolates)) {
|
|
132
|
+
const isolate = (type & isolates) !== 0;
|
|
133
|
+
levels[i] = isolate ? top.level : removed;
|
|
134
|
+
if (isolate && top.override) types[i] = top.override;
|
|
135
|
+
const right = type & (RLE | RLO | RLI) || (type === FSI && firstStrong(original, i + 1, match[i]!, match) === 1);
|
|
136
|
+
const level = right ? (top.level + 1) | 1 : (top.level + 2) & ~1;
|
|
137
|
+
if (level <= maxDepth && overflowIsolates === 0 && overflowEmbeddings === 0) {
|
|
138
|
+
if (isolate) validIsolates++;
|
|
139
|
+
stack.push({ level, override: type === RLO ? R : type === LRO ? L : 0, isolate });
|
|
140
|
+
} else if (isolate) {
|
|
141
|
+
overflowIsolates++;
|
|
142
|
+
} else if (overflowIsolates === 0) {
|
|
143
|
+
overflowEmbeddings++;
|
|
144
|
+
}
|
|
145
|
+
} else if (type === PDI) {
|
|
146
|
+
if (overflowIsolates > 0) {
|
|
147
|
+
overflowIsolates--;
|
|
148
|
+
} else if (validIsolates > 0) {
|
|
149
|
+
overflowEmbeddings = 0;
|
|
150
|
+
while (!stack.at(-1)!.isolate) stack.pop();
|
|
151
|
+
stack.pop();
|
|
152
|
+
validIsolates--;
|
|
153
|
+
}
|
|
154
|
+
top = stack.at(-1)!;
|
|
155
|
+
levels[i] = top.level;
|
|
156
|
+
if (top.override) types[i] = top.override;
|
|
157
|
+
} else if (type === PDF) {
|
|
158
|
+
levels[i] = removed;
|
|
159
|
+
if (overflowIsolates === 0) {
|
|
160
|
+
if (overflowEmbeddings > 0) overflowEmbeddings--;
|
|
161
|
+
else if (!top.isolate && stack.length > 1) stack.pop();
|
|
162
|
+
}
|
|
163
|
+
} else if (type === BN) {
|
|
164
|
+
levels[i] = removed;
|
|
165
|
+
} else if (type === B) {
|
|
166
|
+
levels[i] = paragraph;
|
|
167
|
+
} else {
|
|
168
|
+
levels[i] = top.level;
|
|
169
|
+
if (top.override) types[i] = top.override;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** This function applies the rule BD13. It gives the indexes of each isolating run sequence. */
|
|
175
|
+
function sequencesOf(original: Int32Array, match: Int32Array, levels: readonly number[], start: number, end: number): number[][] {
|
|
176
|
+
const sequences: number[][] = [];
|
|
177
|
+
const continued = new Map<number, number[]>();
|
|
178
|
+
let sequence: number[] = [];
|
|
179
|
+
let level = removed;
|
|
180
|
+
for (let i = start; i < end; i++) {
|
|
181
|
+
if (levels[i] === removed) continue;
|
|
182
|
+
if (levels[i] !== level) {
|
|
183
|
+
level = levels[i]!;
|
|
184
|
+
const next = continued.get(i);
|
|
185
|
+
if (next === undefined) sequences.push((sequence = []));
|
|
186
|
+
else sequence = next;
|
|
187
|
+
}
|
|
188
|
+
sequence.push(i);
|
|
189
|
+
if (original[i]! & isolates) continued.set(match[i]!, sequence);
|
|
190
|
+
}
|
|
191
|
+
return sequences;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** This function applies the rules W1 to W7 to the types of one sequence. */
|
|
195
|
+
function resolveWeak(sequenceTypes: number[], sos: number): void {
|
|
196
|
+
const n = sequenceTypes.length;
|
|
197
|
+
let previous = sos;
|
|
198
|
+
for (let k = 0; k < n; k++) {
|
|
199
|
+
if (sequenceTypes[k] === NSM) sequenceTypes[k] = previous & (isolates | PDI) ? ON : previous;
|
|
200
|
+
previous = sequenceTypes[k]!;
|
|
201
|
+
}
|
|
202
|
+
let last = sos;
|
|
203
|
+
for (let k = 0; k < n; k++) {
|
|
204
|
+
const type = sequenceTypes[k]!;
|
|
205
|
+
if (type & (L | R | AL)) last = type;
|
|
206
|
+
else if (type === EN && last === AL) sequenceTypes[k] = AN;
|
|
207
|
+
if (type === AL) sequenceTypes[k] = R;
|
|
208
|
+
}
|
|
209
|
+
for (let k = 1; k + 1 < n; k++) {
|
|
210
|
+
const type = sequenceTypes[k]!;
|
|
211
|
+
const before = sequenceTypes[k - 1]!;
|
|
212
|
+
if (type & (ES | CS) && before === sequenceTypes[k + 1] && (before === EN || (before === AN && type === CS))) sequenceTypes[k] = before;
|
|
213
|
+
}
|
|
214
|
+
for (let k = 0; k < n; k++) {
|
|
215
|
+
if (sequenceTypes[k] !== ET) continue;
|
|
216
|
+
let end = k;
|
|
217
|
+
while (end < n && sequenceTypes[end] === ET) end++;
|
|
218
|
+
if (sequenceTypes[k - 1] === EN || sequenceTypes[end] === EN) sequenceTypes.fill(EN, k, end);
|
|
219
|
+
k = end - 1;
|
|
220
|
+
}
|
|
221
|
+
last = sos;
|
|
222
|
+
for (let k = 0; k < n; k++) {
|
|
223
|
+
const type = sequenceTypes[k]!;
|
|
224
|
+
if (type & (ES | ET | CS)) sequenceTypes[k] = ON;
|
|
225
|
+
else if (type & (L | R)) last = type;
|
|
226
|
+
else if (type === EN && last === L) sequenceTypes[k] = L;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** This function applies the rules BD16 and N0 to one sequence. A value of `brackets` is above 0 at an opening bracket and below 0 at its closing bracket. */
|
|
231
|
+
function resolveBrackets(sequenceTypes: number[], sequence: readonly number[], original: Int32Array, brackets: readonly number[], direction: number, sos: number): void {
|
|
232
|
+
const pairs: [number, number][] = [];
|
|
233
|
+
const stack: number[] = [];
|
|
234
|
+
const n = sequence.length;
|
|
235
|
+
for (let k = 0; k < n; k++) {
|
|
236
|
+
const bracket = brackets[sequence[k]!];
|
|
237
|
+
if (!bracket || sequenceTypes[k] !== ON) continue;
|
|
238
|
+
if (bracket > 0) {
|
|
239
|
+
if (stack.length === maxBrackets) {
|
|
240
|
+
pairs.length = 0;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
stack.push(k);
|
|
244
|
+
} else {
|
|
245
|
+
for (let depth = stack.length - 1; depth >= 0; depth--) {
|
|
246
|
+
if (brackets[sequence[stack[depth]!]!] !== -bracket) continue;
|
|
247
|
+
pairs.push([stack[depth]!, k]);
|
|
248
|
+
stack.length = depth;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
pairs.sort((first, second) => first[0] - second[0]);
|
|
254
|
+
for (const [open, close] of pairs) {
|
|
255
|
+
let found = 0;
|
|
256
|
+
for (let k = open + 1; k < close && found !== direction; k++) found = strong(sequenceTypes[k]!) || found;
|
|
257
|
+
if (found === 0) continue;
|
|
258
|
+
if (found !== direction) {
|
|
259
|
+
let context = sos;
|
|
260
|
+
for (let k = open - 1; k >= 0; k--) {
|
|
261
|
+
if (strong(sequenceTypes[k]!) === 0) continue;
|
|
262
|
+
context = strong(sequenceTypes[k]!);
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
if (context !== found) found = direction;
|
|
266
|
+
}
|
|
267
|
+
for (const bracket of [open, close]) {
|
|
268
|
+
sequenceTypes[bracket] = found;
|
|
269
|
+
for (let k = bracket + 1; k < n && original[sequence[k]!] === NSM; k++) sequenceTypes[k] = found;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** This function applies the rules N1 and N2 to the types of one sequence. */
|
|
275
|
+
function resolveNeutrals(sequenceTypes: number[], direction: number, sos: number, eos: number): void {
|
|
276
|
+
const n = sequenceTypes.length;
|
|
277
|
+
for (let k = 0; k < n; k++) {
|
|
278
|
+
if (!(sequenceTypes[k]! & neutrals)) continue;
|
|
279
|
+
let end = k;
|
|
280
|
+
while (end < n && sequenceTypes[end]! & neutrals) end++;
|
|
281
|
+
const before = k === 0 ? sos : strong(sequenceTypes[k - 1]!);
|
|
282
|
+
const after = end === n ? eos : strong(sequenceTypes[end]!);
|
|
283
|
+
sequenceTypes.fill(before === after ? before : direction, k, end);
|
|
284
|
+
k = end - 1;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** This function applies the rule X10 and the rules W1 to N2 to one sequence. The level of the rules X1 to X9 gives the values of `sos` and `eos`. */
|
|
289
|
+
function resolveSequence(sequence: readonly number[], original: Int32Array, types: Int32Array, brackets: readonly number[], levels: readonly number[], start: number, end: number, paragraph: number): void {
|
|
290
|
+
const first = sequence[0]!;
|
|
291
|
+
const last = sequence.at(-1)!;
|
|
292
|
+
const level = levels[first]!;
|
|
293
|
+
let before = first - 1;
|
|
294
|
+
while (before >= start && levels[before] === removed) before--;
|
|
295
|
+
let after = last + 1;
|
|
296
|
+
while (after < end && levels[after] === removed) after++;
|
|
297
|
+
const sos = Math.max(level, before < start ? paragraph : levels[before]!) & 1 ? R : L;
|
|
298
|
+
const eos = Math.max(level, after === end || original[last]! & isolates ? paragraph : levels[after]!) & 1 ? R : L;
|
|
299
|
+
const sequenceTypes = sequence.map((i) => types[i]!);
|
|
300
|
+
const direction = level & 1 ? R : L;
|
|
301
|
+
resolveWeak(sequenceTypes, sos);
|
|
302
|
+
resolveBrackets(sequenceTypes, sequence, original, brackets, direction, sos);
|
|
303
|
+
resolveNeutrals(sequenceTypes, direction, sos, eos);
|
|
304
|
+
sequence.forEach((i, k) => {
|
|
305
|
+
types[i] = sequenceTypes[k]!;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** This function applies the rules I1, I2 and L1 to one paragraph. */
|
|
310
|
+
function resolveImplicit(original: Int32Array, types: Int32Array, levels: number[], start: number, end: number, paragraph: number): void {
|
|
311
|
+
let atEnd = true;
|
|
312
|
+
for (let i = end - 1; i >= start; i--) {
|
|
313
|
+
if (levels[i] === removed) continue;
|
|
314
|
+
const type = types[i]!;
|
|
315
|
+
const kind = original[i]!;
|
|
316
|
+
levels[i]! += levels[i]! & 1 ? (type === R ? 0 : 1) : type === L ? 0 : type === R ? 1 : 2;
|
|
317
|
+
if (kind & (S | B)) atEnd = true;
|
|
318
|
+
else if (!(kind & (WS | isolates | PDI))) atEnd = false;
|
|
319
|
+
if (atEnd) levels[i] = paragraph;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* This function gives the levels of a text from its classes, with the rules P1 to L1 of UAX #9. A class `B` ends a paragraph.
|
|
325
|
+
* A value of `brackets` is 0 for a character that is not a paired bracket. It is above 0 at an opening bracket and below 0
|
|
326
|
+
* at the closing bracket with the same absolute value. `bracketOf` of `./bidi` gives these values.
|
|
327
|
+
*/
|
|
328
|
+
export function resolveLevels(classes: readonly BidiClass[], brackets: readonly number[] = [], direction: ParagraphDirection = "auto"): ResolvedBidi {
|
|
329
|
+
const n = classes.length;
|
|
330
|
+
const original = new Int32Array(n);
|
|
331
|
+
for (let i = 0; i < n; i++) original[i] = bits[classes[i]!];
|
|
332
|
+
const types = original.slice();
|
|
333
|
+
const match = new Int32Array(n);
|
|
334
|
+
const levels = new Array<number>(n).fill(0);
|
|
335
|
+
const paragraphs: BidiParagraph[] = [];
|
|
336
|
+
for (let start = 0; start < n; ) {
|
|
337
|
+
let end = start;
|
|
338
|
+
while (end < n && original[end] !== B) end++;
|
|
339
|
+
end = Math.min(end + 1, n);
|
|
340
|
+
matchIsolates(original, start, end, match);
|
|
341
|
+
const level = direction === "auto" ? firstStrong(original, start, end, match) : direction;
|
|
342
|
+
resolveExplicit(original, types, match, levels, start, end, level);
|
|
343
|
+
for (const sequence of sequencesOf(original, match, levels, start, end)) resolveSequence(sequence, original, types, brackets, levels, start, end, level);
|
|
344
|
+
resolveImplicit(original, types, levels, start, end, level);
|
|
345
|
+
paragraphs.push({ start, end, level });
|
|
346
|
+
start = end;
|
|
347
|
+
}
|
|
348
|
+
return { levels, paragraphs };
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* This function puts items in the visual order of the rule L2 of UAX #9. Each item has the level `levels[i]`. From the
|
|
353
|
+
* highest level to the level 1, it reverses each sequence of items at that level or higher.
|
|
354
|
+
*/
|
|
355
|
+
export function visualOrder<T>(items: readonly T[], levels: readonly number[]): T[] {
|
|
356
|
+
const order = items.map((_, i) => i);
|
|
357
|
+
const n = order.length;
|
|
358
|
+
for (let level = levels.reduce((highest, value) => Math.max(highest, value), 0); level >= 1; level--) {
|
|
359
|
+
for (let i = 0; i < n; i++) {
|
|
360
|
+
if (levels[order[i]!]! < level) continue;
|
|
361
|
+
let end = i;
|
|
362
|
+
while (end < n && levels[order[end]!]! >= level) end++;
|
|
363
|
+
for (let low = i, high = end - 1; low < high; low++, high--) [order[low], order[high]] = [order[high]!, order[low]!];
|
|
364
|
+
i = end;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return order.map((i) => items[i]!);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** This function gives the indexes of the characters in the visual order, for each paragraph as one line. It omits each removed character. */
|
|
371
|
+
export function visualIndexes({ levels, paragraphs }: ResolvedBidi): number[] {
|
|
372
|
+
return paragraphs.flatMap(({ start, end }) => {
|
|
373
|
+
const kept: number[] = [];
|
|
374
|
+
for (let i = start; i < end; i++) if (levels[i] !== removed) kept.push(i);
|
|
375
|
+
return visualOrder(
|
|
376
|
+
kept,
|
|
377
|
+
kept.map((i) => levels[i]!),
|
|
378
|
+
);
|
|
379
|
+
});
|
|
380
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Generated by `pnpm --filter @typeset/conformance tables` from Unicode 17.0.0. Do not edit.
|
|
2
|
+
export const unicodeVersion = "17.0.0";
|
|
3
|
+
export const classNames: readonly string[] = ["L","R","AL","ET","EN","ES","AN","CS","B","S","WS","ON","BN","NSM","LRO","RLO","LRE","RLE","PDF","LRI","RLI","FSI","PDI"];
|
|
4
|
+
export const classRuns = "9M1J1I1J1K1IeM3I1J1K2L3D5L1F1H1F2HaE1H6LqA6LqA4L6M1IqM1H1L4D4L1A2L1M2L2D2E1L1A3L1E1A5LnA1LvA1LchA2L7AeL2AeL5A9L1AhL34N4A2L8A1L5A2L1A1L32A1L3wA7N74A1L2A2L1D1B19N1B1N1B2N1B2N1B1N1kB6G2L1C2D1C1H1C2LbN1cClNaG1D2G3C1N2tC7N1G1L6N2C2N1L4N2CaEnC1NuCrN2jCbNfC17B9N2B4L3B1NoB4N1B9N1B3N1B5N17B3N4B1cC2G5C9N16CoN1GwN1jA1N1A1N4A8N4A1N3A7NaA2NtA1N1mA1N4A4N8A1NkA2NeA2D7A1D2A1N2A2N1lA1N4A2N4A2N2A3N3A1NuA2N3A1NbA2N1lA1N4A5N1A2N4A1NkA2NdA1D8A6N1A1N1mA1N2A1N1A4N8A1N7A2NbA2NuA1N1pA1NcA1N11A6L1D1L5A1N3A1N1jA1N1A3N5A3N1A4N7A2NbA2NkA7L2A1N1mA1NfA2NkA2NsA2N1lA2N4A4N8A1NkA2NtA1N20A1N7A3N1A1N2iA1N2A7N4A1D7A8N2qA1N2A9NbA7N21A2NrA1N1A1N1A1N4L1fAeN1A5N1A2N5AbN1A10N9A1N2uA4N1A6N1A2N2A2NpA2N4A3NgA4NdA1N2A2N6A1NfA1NjjA3N1cAaL2uA1LhrA1KqA2L39A3NtA2NuA2NuA2N1sA2N1A7N8A1N2AbN7A1D1A1NiAaL6AbL3N1M1N39A2NyA1N3aA3N4A2N9A1N6A3N4A1L3A2L48AyLnA2N2A1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1 x 1 2 1 2 1 2 1 2 1 b9 1 2 1 2 1 2 1 2 1 2 3 2 -1 2 1 2 1 2 1 2 1 1t 1 2 1 y 1 ti 1 2 1 2 1 2 1 19 1 2 1 2 1 2 1 bx 1 2 1 2 1 2 1 2 1 4 1 2 1 2 1 2 1 14qn 1 2 1 2 1 4r 1 1f 2 w 2 4 1 3 1";
|
package/src/bidi.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { bracketOf } from "./bidi/brackets.ts";
|
|
2
|
+
export { bidiClass, resolveText } from "./bidi/classes.ts";
|
|
3
|
+
export { removed, resolveLevels, visualIndexes, visualOrder, type BidiClass, type BidiParagraph, type ParagraphDirection, type ResolvedBidi } from "./bidi/resolve.ts";
|
|
4
|
+
export { unicodeVersion } from "./bidi/table.ts";
|
package/src/fonts/bidi.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* widths of the words of a canvas in the visual order, so the single-precision sum needs this order. The
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The Unicode Bidirectional Algorithm (UAX #9) for the text of a canvas, as one paragraph with the base level 0. Blink adds
|
|
3
|
+
* the widths of the words of a canvas in the visual order, so the single-precision sum needs this order. The rules are the
|
|
4
|
+
* shared rules of `../bidi/resolve.ts`. This module gets the bidi class of a character from its script and its general
|
|
5
|
+
* category, so that this entry has no class table. `@mark1russell7/typeset/bidi` has the exact classes.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type BidiClass = "L" | "R" | "AL" | "EN" | "ES" | "ET" | "AN" | "CS" | "NSM" | "BN" | "B" | "S" | "WS" | "ON";
|
|
7
|
+
import { bracketOf } from "../bidi/brackets.ts";
|
|
8
|
+
import { removed, resolveLevels, type BidiClass } from "../bidi/resolve.ts";
|
|
10
9
|
|
|
11
10
|
const nonSpacingMark = /[\p{Mn}\p{Me}]/u;
|
|
12
11
|
const currency = /\p{Sc}/u;
|
|
@@ -15,6 +14,8 @@ const hebrew = /\p{Script_Extensions=Hebrew}/u;
|
|
|
15
14
|
const arabicLetter = /[\p{Script_Extensions=Arabic}\p{Script_Extensions=Syriac}\p{Script_Extensions=Thaana}]/u;
|
|
16
15
|
const letter = /[\p{L}\p{Mc}]/u;
|
|
17
16
|
const commonSeparators: ReadonlySet<number> = new Set([0x2c, 0x2e, 0x2f, 0x3a, 0xa0, 0x60c, 0x202f, 0x2044]);
|
|
17
|
+
const embeddings: readonly BidiClass[] = ["LRE", "RLE", "PDF", "LRO", "RLO"];
|
|
18
|
+
const isolates: readonly BidiClass[] = ["LRI", "RLI", "FSI", "PDI"];
|
|
18
19
|
|
|
19
20
|
/** This function gives the bidi class of a character, from its code point, its script and its general category. */
|
|
20
21
|
function bidiClass(character: string): BidiClass {
|
|
@@ -28,98 +29,37 @@ function bidiClass(character: string): BidiClass {
|
|
|
28
29
|
if (c === 0x9 || c === 0xb || c === 0x1f) return "S";
|
|
29
30
|
if (c === 0xa || c === 0xd || (c >= 0x1c && c <= 0x1e) || c === 0x85 || c === 0x2029) return "B";
|
|
30
31
|
if (c === 0x20 || c === 0xc || (c >= 0x2000 && c <= 0x200a) || c === 0x2028 || c === 0x3000) return "WS";
|
|
32
|
+
if (c >= 0x202a && c <= 0x202e) return embeddings[c - 0x202a]!;
|
|
33
|
+
if (c >= 0x2066 && c <= 0x2069) return isolates[c - 0x2066]!;
|
|
34
|
+
if (c === 0x200e) return "L";
|
|
35
|
+
if (c === 0x200f) return "R";
|
|
36
|
+
if (c === 0x61c) return "AL";
|
|
31
37
|
if (format.test(character)) return "BN";
|
|
32
38
|
if (hebrew.test(character)) return "R";
|
|
33
39
|
if (arabicLetter.test(character)) return "AL";
|
|
34
40
|
return letter.test(character) ? "L" : "ON";
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
/** This function gives the direction of a strong class for the rule N1: `EN` and `AN` count as `R`. */
|
|
38
|
-
function strongDirection(type: BidiClass): "L" | "R" | undefined {
|
|
39
|
-
if (type === "L") return "L";
|
|
40
|
-
return type === "R" || type === "EN" || type === "AN" ? "R" : undefined;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
43
|
/**
|
|
44
|
-
* This function gives the bidi level of each code point of a text, in a paragraph with the base level 0.
|
|
45
|
-
*
|
|
44
|
+
* This function gives the bidi level of each code point of a text, in a paragraph with the base level 0. A character that
|
|
45
|
+
* the rule X9 removes takes the level of the character before it. Before white space or a separator, it takes the base level.
|
|
46
46
|
*/
|
|
47
47
|
export function bidiLevels(text: string): number[] {
|
|
48
48
|
const characters = [...text];
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const n =
|
|
52
|
-
|
|
53
|
-
for (let i =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
for (let i = 0; i < n; i++) {
|
|
57
|
-
const type = types[i]!;
|
|
58
|
-
if (type === "L" || type === "R" || type === "AL") strong = type;
|
|
59
|
-
else if (type === "EN" && strong === "AL") types[i] = "AN";
|
|
49
|
+
const classes = characters.map(bidiClass);
|
|
50
|
+
const { levels } = resolveLevels(classes, characters.map((character) => bracketOf(character.codePointAt(0)!)), 0);
|
|
51
|
+
const n = levels.length;
|
|
52
|
+
let atEnd = true;
|
|
53
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
54
|
+
if (levels[i] !== removed) atEnd = classes[i] === "WS" || classes[i] === "S" || classes[i] === "B";
|
|
55
|
+
else if (atEnd) levels[i] = 0;
|
|
60
56
|
}
|
|
61
|
-
|
|
62
|
-
// W4: one separator between two digits of the same class gets their class
|
|
63
|
-
for (let i = 1; i + 1 < n; i++) {
|
|
64
|
-
const before = types[i - 1]!;
|
|
65
|
-
if (types[i] === "ES" && before === "EN" && types[i + 1] === "EN") types[i] = "EN";
|
|
66
|
-
else if (types[i] === "CS" && (before === "EN" || before === "AN") && types[i + 1] === before) types[i] = before;
|
|
67
|
-
}
|
|
68
|
-
// W5: a sequence of terminators next to a European digit is EN
|
|
69
|
-
for (let i = 0; i < n; i++) {
|
|
70
|
-
if (types[i] !== "ET") continue;
|
|
71
|
-
let end = i;
|
|
72
|
-
while (end < n && types[end] === "ET") end++;
|
|
73
|
-
if ((i > 0 && types[i - 1] === "EN") || (end < n && types[end] === "EN")) types.fill("EN", i, end);
|
|
74
|
-
i = end - 1;
|
|
75
|
-
}
|
|
76
|
-
// W6 and W7: the other separators and terminators are ON, and a European digit after L is L
|
|
77
|
-
for (let i = 0; i < n; i++) if (types[i] === "ES" || types[i] === "ET" || types[i] === "CS") types[i] = "ON";
|
|
78
|
-
strong = "L";
|
|
57
|
+
let level = 0;
|
|
79
58
|
for (let i = 0; i < n; i++) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
else if (type === "EN" && strong === "L") types[i] = "L";
|
|
83
|
-
}
|
|
84
|
-
// N1 and N2: a sequence of neutrals gets the direction of the strong characters on its two sides, or else L
|
|
85
|
-
for (let i = 0; i < n; i++) {
|
|
86
|
-
if (strongDirection(types[i]!) !== undefined) continue;
|
|
87
|
-
let end = i;
|
|
88
|
-
while (end < n && strongDirection(types[end]!) === undefined) end++;
|
|
89
|
-
const before = i === 0 ? "L" : strongDirection(types[i - 1]!)!;
|
|
90
|
-
const after = end === n ? "L" : strongDirection(types[end]!)!;
|
|
91
|
-
types.fill(before === after ? before : "L", i, end);
|
|
92
|
-
i = end - 1;
|
|
93
|
-
}
|
|
94
|
-
// I1: R goes up one level, and the digits go up two levels
|
|
95
|
-
const levels = types.map((type) => (type === "R" ? 1 : type === "AN" || type === "EN" ? 2 : 0));
|
|
96
|
-
// L1: the white space at the end and before each separator goes back to the base level
|
|
97
|
-
const isSpace = (i: number) => original[i] === "WS" || original[i] === "BN";
|
|
98
|
-
for (let i = n - 1; i >= 0 && isSpace(i); i--) levels[i] = 0;
|
|
99
|
-
for (let i = 0; i < n; i++) {
|
|
100
|
-
if (original[i] !== "S" && original[i] !== "B") continue;
|
|
101
|
-
levels[i] = 0;
|
|
102
|
-
for (let k = i - 1; k >= 0 && isSpace(k); k--) levels[k] = 0;
|
|
59
|
+
if (levels[i] === removed) levels[i] = level;
|
|
60
|
+
else level = levels[i]!;
|
|
103
61
|
}
|
|
104
62
|
return levels;
|
|
105
63
|
}
|
|
106
64
|
|
|
107
|
-
|
|
108
|
-
* This function puts items in the visual order of the rule L2 of UAX #9. Each item has the level `levels[i]`. From the
|
|
109
|
-
* highest level to the level 1, it reverses each sequence of items at that level or higher.
|
|
110
|
-
*/
|
|
111
|
-
export function visualOrder<T>(items: readonly T[], levels: readonly number[]): T[] {
|
|
112
|
-
const order = items.map((_, i) => i);
|
|
113
|
-
const at = [...levels];
|
|
114
|
-
for (let level = Math.max(0, ...levels); level >= 1; level--) {
|
|
115
|
-
for (let i = 0; i < order.length; i++) {
|
|
116
|
-
if (at[i]! < level) continue;
|
|
117
|
-
let end = i;
|
|
118
|
-
while (end < order.length && at[end]! >= level) end++;
|
|
119
|
-
order.splice(i, end - i, ...order.slice(i, end).reverse());
|
|
120
|
-
at.splice(i, end - i, ...at.slice(i, end).reverse());
|
|
121
|
-
i = end;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return order.map((i) => items[i]!);
|
|
125
|
-
}
|
|
65
|
+
export { visualOrder } from "../bidi/resolve.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by `pnpm --filter @typeset/conformance tables` from Unicode 17.0.0. Do not edit.
|
|
2
2
|
export const unicodeVersion = "17.0.0";
|
|
3
|
-
export const classNames: readonly string[] = "AL CM BA LF BK CR SP EX QU PR PO OP CP IS HY SY NU CL NL GL BB HH HL JL JV JT NS AK VI AS ID VF ZW ZWJ B2 IN WJ EB H2 H3 CB AP RI EM".split(" ");
|
|
4
|
-
export const classRuns = "
|
|
3
|
+
export const classNames: readonly string[] = "AL CM BA LF BK CR SP EX QU PR PO OP CP IS HY SY NU CL NL GL BB HH HL SA JL JV JT NS AK VI AS ID VF ZW ZWJ B2 IN WJ EB H2 H3 CB AP RI EM".split(" ");
|
|
4
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