ltms-reader 0.0.0-stage → 0.1.0
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/CHANGELOG.md +136 -0
- package/LICENSE +21 -0
- package/LICENSE-UNICODE +49 -0
- package/README.md +284 -2
- package/bin/ltms-reader.mjs +16 -0
- package/package.json +32 -4
- package/src/app.mjs +415 -0
- package/src/bidi-table.mjs +354 -0
- package/src/bidi.mjs +251 -0
- package/src/engine.mjs +505 -0
- package/src/guard.mjs +116 -0
- package/src/helper.mjs +127 -0
- package/src/layout.mjs +181 -0
- package/src/lines.mjs +18 -0
- package/src/main.mjs +133 -0
- package/src/reading.mjs +165 -0
- package/src/screen-process.mjs +6 -0
- package/src/screen.mjs +127 -0
- package/src/sources.mjs +134 -0
- package/src/start.mjs +123 -0
- package/src/text.mjs +712 -0
- package/src/view.mjs +337 -0
- package/src/views.mjs +518 -0
- package/src/width-table.mjs +101 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
// src/bidi-table.mjs — WRITTEN BY scripts/bidi-table.mjs; do not edit it by hand: change the script, and run it again.
|
|
2
|
+
//
|
|
3
|
+
// What src/bidi.mjs, the Unicode Bidirectional Algorithm, needs to know of each code point: its Bidi_Class, as ranges
|
|
4
|
+
// [first, last, class, ...] of the code points whose class is not L (the class is an index into CLASSES); the paired
|
|
5
|
+
// brackets [opening, closing, ...]; the two brackets' canonical equivalents [code point, equivalent, ...]; and the
|
|
6
|
+
// mirrored glyphs [code point, mirror, ...].
|
|
7
|
+
//
|
|
8
|
+
// From the Unicode Character Database, version 17.0.0:
|
|
9
|
+
// DerivedBidiClass.txt https://www.unicode.org/Public/17.0.0/ucd/extracted/DerivedBidiClass.txt
|
|
10
|
+
// sha256 4867b4b7f0731ed1bfcd34cc6251211ff1542541fce0734b6fbda139ee80b3a4
|
|
11
|
+
// UnicodeData.txt https://www.unicode.org/Public/17.0.0/ucd/UnicodeData.txt
|
|
12
|
+
// sha256 2e1efc1dcb59c575eedf5ccae60f95229f706ee6d031835247d843c11d96470c
|
|
13
|
+
// BidiBrackets.txt https://www.unicode.org/Public/17.0.0/ucd/BidiBrackets.txt
|
|
14
|
+
// sha256 dadbaf38a0d0246e5b805bf8725cb81b7c621f93d030595635f5ba2c2f179428
|
|
15
|
+
// BidiMirroring.txt https://www.unicode.org/Public/17.0.0/ucd/BidiMirroring.txt
|
|
16
|
+
// sha256 a2f16fb873ab4fcdf3221cb1a8a85a134ddd6ed03603181823ff5206af3741ce
|
|
17
|
+
//
|
|
18
|
+
// Their licence (LICENSE-UNICODE, which the package ships beside this table):
|
|
19
|
+
//
|
|
20
|
+
// Two files of this package are derived from the Unicode Character Database, version 17.0.0, whose files' headers say
|
|
21
|
+
// "© 2025 Unicode®, Inc.":
|
|
22
|
+
// - src/width-table.mjs from EastAsianWidth.txt (https://www.unicode.org/Public/17.0.0/ucd/EastAsianWidth.txt, sha256
|
|
23
|
+
// ea7ce50f3444a050333448dffef1cadd9325af55cbb764b4a2280faf52170a33);
|
|
24
|
+
// - src/bidi-table.mjs from DerivedBidiClass.txt, UnicodeData.txt, BidiBrackets.txt and BidiMirroring.txt
|
|
25
|
+
// (https://www.unicode.org/Public/17.0.0/ucd/, each named with its sha256 at the head of the table).
|
|
26
|
+
// They are used under this licence, the Unicode License v3 (https://www.unicode.org/license.txt):
|
|
27
|
+
//
|
|
28
|
+
// UNICODE LICENSE V3
|
|
29
|
+
//
|
|
30
|
+
// COPYRIGHT AND PERMISSION NOTICE
|
|
31
|
+
//
|
|
32
|
+
// Copyright © 2025 Unicode, Inc.
|
|
33
|
+
//
|
|
34
|
+
// NOTICE TO USER: Carefully read the following legal agreement. BY
|
|
35
|
+
// DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
|
|
36
|
+
// SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
|
|
37
|
+
// TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
|
|
38
|
+
// DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
|
|
39
|
+
//
|
|
40
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
41
|
+
// copy of data files and any associated documentation (the "Data Files") or
|
|
42
|
+
// software and any associated documentation (the "Software") to deal in the
|
|
43
|
+
// Data Files or Software without restriction, including without limitation
|
|
44
|
+
// the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
|
45
|
+
// copies of the Data Files or Software, and to permit persons to whom the
|
|
46
|
+
// Data Files or Software are furnished to do so, provided that either (a)
|
|
47
|
+
// this copyright and permission notice appear with all copies of the Data
|
|
48
|
+
// Files or Software, or (b) this copyright and permission notice appear in
|
|
49
|
+
// associated Documentation.
|
|
50
|
+
//
|
|
51
|
+
// THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
52
|
+
// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
53
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
54
|
+
// THIRD PARTY RIGHTS.
|
|
55
|
+
//
|
|
56
|
+
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
|
|
57
|
+
// BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
|
|
58
|
+
// OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
59
|
+
// WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
60
|
+
// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
|
|
61
|
+
// FILES OR SOFTWARE.
|
|
62
|
+
//
|
|
63
|
+
// Except as contained in this notice, the name of a copyright holder shall
|
|
64
|
+
// not be used in advertising or otherwise to promote the sale, use or other
|
|
65
|
+
// dealings in these Data Files or Software without prior written
|
|
66
|
+
// authorization of the copyright holder.
|
|
67
|
+
//
|
|
68
|
+
// SPDX-License-Identifier: Unicode-3.0
|
|
69
|
+
export const UNICODE_VERSION = '17.0.0';
|
|
70
|
+
export const SOURCE_SHA256 = Object.freeze({"DerivedBidiClass.txt":"4867b4b7f0731ed1bfcd34cc6251211ff1542541fce0734b6fbda139ee80b3a4","UnicodeData.txt":"2e1efc1dcb59c575eedf5ccae60f95229f706ee6d031835247d843c11d96470c","BidiBrackets.txt":"dadbaf38a0d0246e5b805bf8725cb81b7c621f93d030595635f5ba2c2f179428","BidiMirroring.txt":"a2f16fb873ab4fcdf3221cb1a8a85a134ddd6ed03603181823ff5206af3741ce"});
|
|
71
|
+
export const CLASSES = Object.freeze(["L","R","AL","EN","ES","ET","AN","CS","NSM","BN","B","S","WS","ON","LRE","LRO","RLE","RLO","PDF","LRI","RLI","FSI","PDI"]);
|
|
72
|
+
export const CLASS_RANGES = Object.freeze([
|
|
73
|
+
0x0000, 0x0008, 0x0009, 0x0009, 0x0009, 0x000b, 0x000a, 0x000a, 0x000a, 0x000b, 0x000b, 0x000b,
|
|
74
|
+
0x000c, 0x000c, 0x000c, 0x000d, 0x000d, 0x000a, 0x000e, 0x001b, 0x0009, 0x001c, 0x001e, 0x000a,
|
|
75
|
+
0x001f, 0x001f, 0x000b, 0x0020, 0x0020, 0x000c, 0x0021, 0x0022, 0x000d, 0x0023, 0x0025, 0x0005,
|
|
76
|
+
0x0026, 0x002a, 0x000d, 0x002b, 0x002b, 0x0004, 0x002c, 0x002c, 0x0007, 0x002d, 0x002d, 0x0004,
|
|
77
|
+
0x002e, 0x002f, 0x0007, 0x0030, 0x0039, 0x0003, 0x003a, 0x003a, 0x0007, 0x003b, 0x0040, 0x000d,
|
|
78
|
+
0x005b, 0x0060, 0x000d, 0x007b, 0x007e, 0x000d, 0x007f, 0x0084, 0x0009, 0x0085, 0x0085, 0x000a,
|
|
79
|
+
0x0086, 0x009f, 0x0009, 0x00a0, 0x00a0, 0x0007, 0x00a1, 0x00a1, 0x000d, 0x00a2, 0x00a5, 0x0005,
|
|
80
|
+
0x00a6, 0x00a9, 0x000d, 0x00ab, 0x00ac, 0x000d, 0x00ad, 0x00ad, 0x0009, 0x00ae, 0x00af, 0x000d,
|
|
81
|
+
0x00b0, 0x00b1, 0x0005, 0x00b2, 0x00b3, 0x0003, 0x00b4, 0x00b4, 0x000d, 0x00b6, 0x00b8, 0x000d,
|
|
82
|
+
0x00b9, 0x00b9, 0x0003, 0x00bb, 0x00bf, 0x000d, 0x00d7, 0x00d7, 0x000d, 0x00f7, 0x00f7, 0x000d,
|
|
83
|
+
0x02b9, 0x02ba, 0x000d, 0x02c2, 0x02cf, 0x000d, 0x02d2, 0x02df, 0x000d, 0x02e5, 0x02ed, 0x000d,
|
|
84
|
+
0x02ef, 0x02ff, 0x000d, 0x0300, 0x036f, 0x0008, 0x0374, 0x0375, 0x000d, 0x037e, 0x037e, 0x000d,
|
|
85
|
+
0x0384, 0x0385, 0x000d, 0x0387, 0x0387, 0x000d, 0x03f6, 0x03f6, 0x000d, 0x0483, 0x0489, 0x0008,
|
|
86
|
+
0x058a, 0x058a, 0x000d, 0x058d, 0x058e, 0x000d, 0x058f, 0x058f, 0x0005, 0x0590, 0x0590, 0x0001,
|
|
87
|
+
0x0591, 0x05bd, 0x0008, 0x05be, 0x05be, 0x0001, 0x05bf, 0x05bf, 0x0008, 0x05c0, 0x05c0, 0x0001,
|
|
88
|
+
0x05c1, 0x05c2, 0x0008, 0x05c3, 0x05c3, 0x0001, 0x05c4, 0x05c5, 0x0008, 0x05c6, 0x05c6, 0x0001,
|
|
89
|
+
0x05c7, 0x05c7, 0x0008, 0x05c8, 0x05ff, 0x0001, 0x0600, 0x0605, 0x0006, 0x0606, 0x0607, 0x000d,
|
|
90
|
+
0x0608, 0x0608, 0x0002, 0x0609, 0x060a, 0x0005, 0x060b, 0x060b, 0x0002, 0x060c, 0x060c, 0x0007,
|
|
91
|
+
0x060d, 0x060d, 0x0002, 0x060e, 0x060f, 0x000d, 0x0610, 0x061a, 0x0008, 0x061b, 0x064a, 0x0002,
|
|
92
|
+
0x064b, 0x065f, 0x0008, 0x0660, 0x0669, 0x0006, 0x066a, 0x066a, 0x0005, 0x066b, 0x066c, 0x0006,
|
|
93
|
+
0x066d, 0x066f, 0x0002, 0x0670, 0x0670, 0x0008, 0x0671, 0x06d5, 0x0002, 0x06d6, 0x06dc, 0x0008,
|
|
94
|
+
0x06dd, 0x06dd, 0x0006, 0x06de, 0x06de, 0x000d, 0x06df, 0x06e4, 0x0008, 0x06e5, 0x06e6, 0x0002,
|
|
95
|
+
0x06e7, 0x06e8, 0x0008, 0x06e9, 0x06e9, 0x000d, 0x06ea, 0x06ed, 0x0008, 0x06ee, 0x06ef, 0x0002,
|
|
96
|
+
0x06f0, 0x06f9, 0x0003, 0x06fa, 0x0710, 0x0002, 0x0711, 0x0711, 0x0008, 0x0712, 0x072f, 0x0002,
|
|
97
|
+
0x0730, 0x074a, 0x0008, 0x074b, 0x07a5, 0x0002, 0x07a6, 0x07b0, 0x0008, 0x07b1, 0x07bf, 0x0002,
|
|
98
|
+
0x07c0, 0x07ea, 0x0001, 0x07eb, 0x07f3, 0x0008, 0x07f4, 0x07f5, 0x0001, 0x07f6, 0x07f9, 0x000d,
|
|
99
|
+
0x07fa, 0x07fc, 0x0001, 0x07fd, 0x07fd, 0x0008, 0x07fe, 0x0815, 0x0001, 0x0816, 0x0819, 0x0008,
|
|
100
|
+
0x081a, 0x081a, 0x0001, 0x081b, 0x0823, 0x0008, 0x0824, 0x0824, 0x0001, 0x0825, 0x0827, 0x0008,
|
|
101
|
+
0x0828, 0x0828, 0x0001, 0x0829, 0x082d, 0x0008, 0x082e, 0x0858, 0x0001, 0x0859, 0x085b, 0x0008,
|
|
102
|
+
0x085c, 0x085f, 0x0001, 0x0860, 0x088f, 0x0002, 0x0890, 0x0891, 0x0006, 0x0892, 0x0896, 0x0002,
|
|
103
|
+
0x0897, 0x089f, 0x0008, 0x08a0, 0x08c9, 0x0002, 0x08ca, 0x08e1, 0x0008, 0x08e2, 0x08e2, 0x0006,
|
|
104
|
+
0x08e3, 0x0902, 0x0008, 0x093a, 0x093a, 0x0008, 0x093c, 0x093c, 0x0008, 0x0941, 0x0948, 0x0008,
|
|
105
|
+
0x094d, 0x094d, 0x0008, 0x0951, 0x0957, 0x0008, 0x0962, 0x0963, 0x0008, 0x0981, 0x0981, 0x0008,
|
|
106
|
+
0x09bc, 0x09bc, 0x0008, 0x09c1, 0x09c4, 0x0008, 0x09cd, 0x09cd, 0x0008, 0x09e2, 0x09e3, 0x0008,
|
|
107
|
+
0x09f2, 0x09f3, 0x0005, 0x09fb, 0x09fb, 0x0005, 0x09fe, 0x09fe, 0x0008, 0x0a01, 0x0a02, 0x0008,
|
|
108
|
+
0x0a3c, 0x0a3c, 0x0008, 0x0a41, 0x0a42, 0x0008, 0x0a47, 0x0a48, 0x0008, 0x0a4b, 0x0a4d, 0x0008,
|
|
109
|
+
0x0a51, 0x0a51, 0x0008, 0x0a70, 0x0a71, 0x0008, 0x0a75, 0x0a75, 0x0008, 0x0a81, 0x0a82, 0x0008,
|
|
110
|
+
0x0abc, 0x0abc, 0x0008, 0x0ac1, 0x0ac5, 0x0008, 0x0ac7, 0x0ac8, 0x0008, 0x0acd, 0x0acd, 0x0008,
|
|
111
|
+
0x0ae2, 0x0ae3, 0x0008, 0x0af1, 0x0af1, 0x0005, 0x0afa, 0x0aff, 0x0008, 0x0b01, 0x0b01, 0x0008,
|
|
112
|
+
0x0b3c, 0x0b3c, 0x0008, 0x0b3f, 0x0b3f, 0x0008, 0x0b41, 0x0b44, 0x0008, 0x0b4d, 0x0b4d, 0x0008,
|
|
113
|
+
0x0b55, 0x0b56, 0x0008, 0x0b62, 0x0b63, 0x0008, 0x0b82, 0x0b82, 0x0008, 0x0bc0, 0x0bc0, 0x0008,
|
|
114
|
+
0x0bcd, 0x0bcd, 0x0008, 0x0bf3, 0x0bf8, 0x000d, 0x0bf9, 0x0bf9, 0x0005, 0x0bfa, 0x0bfa, 0x000d,
|
|
115
|
+
0x0c00, 0x0c00, 0x0008, 0x0c04, 0x0c04, 0x0008, 0x0c3c, 0x0c3c, 0x0008, 0x0c3e, 0x0c40, 0x0008,
|
|
116
|
+
0x0c46, 0x0c48, 0x0008, 0x0c4a, 0x0c4d, 0x0008, 0x0c55, 0x0c56, 0x0008, 0x0c62, 0x0c63, 0x0008,
|
|
117
|
+
0x0c78, 0x0c7e, 0x000d, 0x0c81, 0x0c81, 0x0008, 0x0cbc, 0x0cbc, 0x0008, 0x0ccc, 0x0ccd, 0x0008,
|
|
118
|
+
0x0ce2, 0x0ce3, 0x0008, 0x0d00, 0x0d01, 0x0008, 0x0d3b, 0x0d3c, 0x0008, 0x0d41, 0x0d44, 0x0008,
|
|
119
|
+
0x0d4d, 0x0d4d, 0x0008, 0x0d62, 0x0d63, 0x0008, 0x0d81, 0x0d81, 0x0008, 0x0dca, 0x0dca, 0x0008,
|
|
120
|
+
0x0dd2, 0x0dd4, 0x0008, 0x0dd6, 0x0dd6, 0x0008, 0x0e31, 0x0e31, 0x0008, 0x0e34, 0x0e3a, 0x0008,
|
|
121
|
+
0x0e3f, 0x0e3f, 0x0005, 0x0e47, 0x0e4e, 0x0008, 0x0eb1, 0x0eb1, 0x0008, 0x0eb4, 0x0ebc, 0x0008,
|
|
122
|
+
0x0ec8, 0x0ece, 0x0008, 0x0f18, 0x0f19, 0x0008, 0x0f35, 0x0f35, 0x0008, 0x0f37, 0x0f37, 0x0008,
|
|
123
|
+
0x0f39, 0x0f39, 0x0008, 0x0f3a, 0x0f3d, 0x000d, 0x0f71, 0x0f7e, 0x0008, 0x0f80, 0x0f84, 0x0008,
|
|
124
|
+
0x0f86, 0x0f87, 0x0008, 0x0f8d, 0x0f97, 0x0008, 0x0f99, 0x0fbc, 0x0008, 0x0fc6, 0x0fc6, 0x0008,
|
|
125
|
+
0x102d, 0x1030, 0x0008, 0x1032, 0x1037, 0x0008, 0x1039, 0x103a, 0x0008, 0x103d, 0x103e, 0x0008,
|
|
126
|
+
0x1058, 0x1059, 0x0008, 0x105e, 0x1060, 0x0008, 0x1071, 0x1074, 0x0008, 0x1082, 0x1082, 0x0008,
|
|
127
|
+
0x1085, 0x1086, 0x0008, 0x108d, 0x108d, 0x0008, 0x109d, 0x109d, 0x0008, 0x135d, 0x135f, 0x0008,
|
|
128
|
+
0x1390, 0x1399, 0x000d, 0x1400, 0x1400, 0x000d, 0x1680, 0x1680, 0x000c, 0x169b, 0x169c, 0x000d,
|
|
129
|
+
0x1712, 0x1714, 0x0008, 0x1732, 0x1733, 0x0008, 0x1752, 0x1753, 0x0008, 0x1772, 0x1773, 0x0008,
|
|
130
|
+
0x17b4, 0x17b5, 0x0008, 0x17b7, 0x17bd, 0x0008, 0x17c6, 0x17c6, 0x0008, 0x17c9, 0x17d3, 0x0008,
|
|
131
|
+
0x17db, 0x17db, 0x0005, 0x17dd, 0x17dd, 0x0008, 0x17f0, 0x17f9, 0x000d, 0x1800, 0x180a, 0x000d,
|
|
132
|
+
0x180b, 0x180d, 0x0008, 0x180e, 0x180e, 0x0009, 0x180f, 0x180f, 0x0008, 0x1885, 0x1886, 0x0008,
|
|
133
|
+
0x18a9, 0x18a9, 0x0008, 0x1920, 0x1922, 0x0008, 0x1927, 0x1928, 0x0008, 0x1932, 0x1932, 0x0008,
|
|
134
|
+
0x1939, 0x193b, 0x0008, 0x1940, 0x1940, 0x000d, 0x1944, 0x1945, 0x000d, 0x19de, 0x19ff, 0x000d,
|
|
135
|
+
0x1a17, 0x1a18, 0x0008, 0x1a1b, 0x1a1b, 0x0008, 0x1a56, 0x1a56, 0x0008, 0x1a58, 0x1a5e, 0x0008,
|
|
136
|
+
0x1a60, 0x1a60, 0x0008, 0x1a62, 0x1a62, 0x0008, 0x1a65, 0x1a6c, 0x0008, 0x1a73, 0x1a7c, 0x0008,
|
|
137
|
+
0x1a7f, 0x1a7f, 0x0008, 0x1ab0, 0x1add, 0x0008, 0x1ae0, 0x1aeb, 0x0008, 0x1b00, 0x1b03, 0x0008,
|
|
138
|
+
0x1b34, 0x1b34, 0x0008, 0x1b36, 0x1b3a, 0x0008, 0x1b3c, 0x1b3c, 0x0008, 0x1b42, 0x1b42, 0x0008,
|
|
139
|
+
0x1b6b, 0x1b73, 0x0008, 0x1b80, 0x1b81, 0x0008, 0x1ba2, 0x1ba5, 0x0008, 0x1ba8, 0x1ba9, 0x0008,
|
|
140
|
+
0x1bab, 0x1bad, 0x0008, 0x1be6, 0x1be6, 0x0008, 0x1be8, 0x1be9, 0x0008, 0x1bed, 0x1bed, 0x0008,
|
|
141
|
+
0x1bef, 0x1bf1, 0x0008, 0x1c2c, 0x1c33, 0x0008, 0x1c36, 0x1c37, 0x0008, 0x1cd0, 0x1cd2, 0x0008,
|
|
142
|
+
0x1cd4, 0x1ce0, 0x0008, 0x1ce2, 0x1ce8, 0x0008, 0x1ced, 0x1ced, 0x0008, 0x1cf4, 0x1cf4, 0x0008,
|
|
143
|
+
0x1cf8, 0x1cf9, 0x0008, 0x1dc0, 0x1dff, 0x0008, 0x1fbd, 0x1fbd, 0x000d, 0x1fbf, 0x1fc1, 0x000d,
|
|
144
|
+
0x1fcd, 0x1fcf, 0x000d, 0x1fdd, 0x1fdf, 0x000d, 0x1fed, 0x1fef, 0x000d, 0x1ffd, 0x1ffe, 0x000d,
|
|
145
|
+
0x2000, 0x200a, 0x000c, 0x200b, 0x200d, 0x0009, 0x200f, 0x200f, 0x0001, 0x2010, 0x2027, 0x000d,
|
|
146
|
+
0x2028, 0x2028, 0x000c, 0x2029, 0x2029, 0x000a, 0x202a, 0x202a, 0x000e, 0x202b, 0x202b, 0x0010,
|
|
147
|
+
0x202c, 0x202c, 0x0012, 0x202d, 0x202d, 0x000f, 0x202e, 0x202e, 0x0011, 0x202f, 0x202f, 0x0007,
|
|
148
|
+
0x2030, 0x2034, 0x0005, 0x2035, 0x2043, 0x000d, 0x2044, 0x2044, 0x0007, 0x2045, 0x205e, 0x000d,
|
|
149
|
+
0x205f, 0x205f, 0x000c, 0x2060, 0x2065, 0x0009, 0x2066, 0x2066, 0x0013, 0x2067, 0x2067, 0x0014,
|
|
150
|
+
0x2068, 0x2068, 0x0015, 0x2069, 0x2069, 0x0016, 0x206a, 0x206f, 0x0009, 0x2070, 0x2070, 0x0003,
|
|
151
|
+
0x2074, 0x2079, 0x0003, 0x207a, 0x207b, 0x0004, 0x207c, 0x207e, 0x000d, 0x2080, 0x2089, 0x0003,
|
|
152
|
+
0x208a, 0x208b, 0x0004, 0x208c, 0x208e, 0x000d, 0x20a0, 0x20cf, 0x0005, 0x20d0, 0x20f0, 0x0008,
|
|
153
|
+
0x2100, 0x2101, 0x000d, 0x2103, 0x2106, 0x000d, 0x2108, 0x2109, 0x000d, 0x2114, 0x2114, 0x000d,
|
|
154
|
+
0x2116, 0x2118, 0x000d, 0x211e, 0x2123, 0x000d, 0x2125, 0x2125, 0x000d, 0x2127, 0x2127, 0x000d,
|
|
155
|
+
0x2129, 0x2129, 0x000d, 0x212e, 0x212e, 0x0005, 0x213a, 0x213b, 0x000d, 0x2140, 0x2144, 0x000d,
|
|
156
|
+
0x214a, 0x214d, 0x000d, 0x2150, 0x215f, 0x000d, 0x2189, 0x218b, 0x000d, 0x2190, 0x2211, 0x000d,
|
|
157
|
+
0x2212, 0x2212, 0x0004, 0x2213, 0x2213, 0x0005, 0x2214, 0x2335, 0x000d, 0x237b, 0x2394, 0x000d,
|
|
158
|
+
0x2396, 0x2429, 0x000d, 0x2440, 0x244a, 0x000d, 0x2460, 0x2487, 0x000d, 0x2488, 0x249b, 0x0003,
|
|
159
|
+
0x24ea, 0x26ab, 0x000d, 0x26ad, 0x27ff, 0x000d, 0x2900, 0x2b73, 0x000d, 0x2b76, 0x2bff, 0x000d,
|
|
160
|
+
0x2ce5, 0x2cea, 0x000d, 0x2cef, 0x2cf1, 0x0008, 0x2cf9, 0x2cff, 0x000d, 0x2d7f, 0x2d7f, 0x0008,
|
|
161
|
+
0x2de0, 0x2dff, 0x0008, 0x2e00, 0x2e5d, 0x000d, 0x2e80, 0x2e99, 0x000d, 0x2e9b, 0x2ef3, 0x000d,
|
|
162
|
+
0x2f00, 0x2fd5, 0x000d, 0x2ff0, 0x2fff, 0x000d, 0x3000, 0x3000, 0x000c, 0x3001, 0x3004, 0x000d,
|
|
163
|
+
0x3008, 0x3020, 0x000d, 0x302a, 0x302d, 0x0008, 0x3030, 0x3030, 0x000d, 0x3036, 0x3037, 0x000d,
|
|
164
|
+
0x303d, 0x303f, 0x000d, 0x3099, 0x309a, 0x0008, 0x309b, 0x309c, 0x000d, 0x30a0, 0x30a0, 0x000d,
|
|
165
|
+
0x30fb, 0x30fb, 0x000d, 0x31c0, 0x31e5, 0x000d, 0x31ef, 0x31ef, 0x000d, 0x321d, 0x321e, 0x000d,
|
|
166
|
+
0x3250, 0x325f, 0x000d, 0x327c, 0x327e, 0x000d, 0x32b1, 0x32bf, 0x000d, 0x32cc, 0x32cf, 0x000d,
|
|
167
|
+
0x3377, 0x337a, 0x000d, 0x33de, 0x33df, 0x000d, 0x33ff, 0x33ff, 0x000d, 0x4dc0, 0x4dff, 0x000d,
|
|
168
|
+
0xa490, 0xa4c6, 0x000d, 0xa60d, 0xa60f, 0x000d, 0xa66f, 0xa672, 0x0008, 0xa673, 0xa673, 0x000d,
|
|
169
|
+
0xa674, 0xa67d, 0x0008, 0xa67e, 0xa67f, 0x000d, 0xa69e, 0xa69f, 0x0008, 0xa6f0, 0xa6f1, 0x0008,
|
|
170
|
+
0xa700, 0xa721, 0x000d, 0xa788, 0xa788, 0x000d, 0xa802, 0xa802, 0x0008, 0xa806, 0xa806, 0x0008,
|
|
171
|
+
0xa80b, 0xa80b, 0x0008, 0xa825, 0xa826, 0x0008, 0xa828, 0xa82b, 0x000d, 0xa82c, 0xa82c, 0x0008,
|
|
172
|
+
0xa838, 0xa839, 0x0005, 0xa874, 0xa877, 0x000d, 0xa8c4, 0xa8c5, 0x0008, 0xa8e0, 0xa8f1, 0x0008,
|
|
173
|
+
0xa8ff, 0xa8ff, 0x0008, 0xa926, 0xa92d, 0x0008, 0xa947, 0xa951, 0x0008, 0xa980, 0xa982, 0x0008,
|
|
174
|
+
0xa9b3, 0xa9b3, 0x0008, 0xa9b6, 0xa9b9, 0x0008, 0xa9bc, 0xa9bd, 0x0008, 0xa9e5, 0xa9e5, 0x0008,
|
|
175
|
+
0xaa29, 0xaa2e, 0x0008, 0xaa31, 0xaa32, 0x0008, 0xaa35, 0xaa36, 0x0008, 0xaa43, 0xaa43, 0x0008,
|
|
176
|
+
0xaa4c, 0xaa4c, 0x0008, 0xaa7c, 0xaa7c, 0x0008, 0xaab0, 0xaab0, 0x0008, 0xaab2, 0xaab4, 0x0008,
|
|
177
|
+
0xaab7, 0xaab8, 0x0008, 0xaabe, 0xaabf, 0x0008, 0xaac1, 0xaac1, 0x0008, 0xaaec, 0xaaed, 0x0008,
|
|
178
|
+
0xaaf6, 0xaaf6, 0x0008, 0xab6a, 0xab6b, 0x000d, 0xabe5, 0xabe5, 0x0008, 0xabe8, 0xabe8, 0x0008,
|
|
179
|
+
0xabed, 0xabed, 0x0008, 0xfb1d, 0xfb1d, 0x0001, 0xfb1e, 0xfb1e, 0x0008, 0xfb1f, 0xfb28, 0x0001,
|
|
180
|
+
0xfb29, 0xfb29, 0x0004, 0xfb2a, 0xfb4f, 0x0001, 0xfb50, 0xfbc2, 0x0002, 0xfbc3, 0xfbd2, 0x000d,
|
|
181
|
+
0xfbd3, 0xfd3d, 0x0002, 0xfd3e, 0xfd4f, 0x000d, 0xfd50, 0xfd8f, 0x0002, 0xfd90, 0xfd91, 0x000d,
|
|
182
|
+
0xfd92, 0xfdc7, 0x0002, 0xfdc8, 0xfdcf, 0x000d, 0xfdd0, 0xfdef, 0x0009, 0xfdf0, 0xfdfc, 0x0002,
|
|
183
|
+
0xfdfd, 0xfdff, 0x000d, 0xfe00, 0xfe0f, 0x0008, 0xfe10, 0xfe19, 0x000d, 0xfe20, 0xfe2f, 0x0008,
|
|
184
|
+
0xfe30, 0xfe4f, 0x000d, 0xfe50, 0xfe50, 0x0007, 0xfe51, 0xfe51, 0x000d, 0xfe52, 0xfe52, 0x0007,
|
|
185
|
+
0xfe54, 0xfe54, 0x000d, 0xfe55, 0xfe55, 0x0007, 0xfe56, 0xfe5e, 0x000d, 0xfe5f, 0xfe5f, 0x0005,
|
|
186
|
+
0xfe60, 0xfe61, 0x000d, 0xfe62, 0xfe63, 0x0004, 0xfe64, 0xfe66, 0x000d, 0xfe68, 0xfe68, 0x000d,
|
|
187
|
+
0xfe69, 0xfe6a, 0x0005, 0xfe6b, 0xfe6b, 0x000d, 0xfe70, 0xfefe, 0x0002, 0xfeff, 0xfeff, 0x0009,
|
|
188
|
+
0xff01, 0xff02, 0x000d, 0xff03, 0xff05, 0x0005, 0xff06, 0xff0a, 0x000d, 0xff0b, 0xff0b, 0x0004,
|
|
189
|
+
0xff0c, 0xff0c, 0x0007, 0xff0d, 0xff0d, 0x0004, 0xff0e, 0xff0f, 0x0007, 0xff10, 0xff19, 0x0003,
|
|
190
|
+
0xff1a, 0xff1a, 0x0007, 0xff1b, 0xff20, 0x000d, 0xff3b, 0xff40, 0x000d, 0xff5b, 0xff65, 0x000d,
|
|
191
|
+
0xffe0, 0xffe1, 0x0005, 0xffe2, 0xffe4, 0x000d, 0xffe5, 0xffe6, 0x0005, 0xffe8, 0xffee, 0x000d,
|
|
192
|
+
0xfff0, 0xfff8, 0x0009, 0xfff9, 0xfffd, 0x000d, 0xfffe, 0xffff, 0x0009, 0x10101, 0x10101, 0x000d,
|
|
193
|
+
0x10140, 0x1018c, 0x000d, 0x10190, 0x1019c, 0x000d, 0x101a0, 0x101a0, 0x000d, 0x101fd, 0x101fd, 0x0008,
|
|
194
|
+
0x102e0, 0x102e0, 0x0008, 0x102e1, 0x102fb, 0x0003, 0x10376, 0x1037a, 0x0008, 0x10800, 0x1091e, 0x0001,
|
|
195
|
+
0x1091f, 0x1091f, 0x000d, 0x10920, 0x10a00, 0x0001, 0x10a01, 0x10a03, 0x0008, 0x10a04, 0x10a04, 0x0001,
|
|
196
|
+
0x10a05, 0x10a06, 0x0008, 0x10a07, 0x10a0b, 0x0001, 0x10a0c, 0x10a0f, 0x0008, 0x10a10, 0x10a37, 0x0001,
|
|
197
|
+
0x10a38, 0x10a3a, 0x0008, 0x10a3b, 0x10a3e, 0x0001, 0x10a3f, 0x10a3f, 0x0008, 0x10a40, 0x10ae4, 0x0001,
|
|
198
|
+
0x10ae5, 0x10ae6, 0x0008, 0x10ae7, 0x10b38, 0x0001, 0x10b39, 0x10b3f, 0x000d, 0x10b40, 0x10cff, 0x0001,
|
|
199
|
+
0x10d00, 0x10d23, 0x0002, 0x10d24, 0x10d27, 0x0008, 0x10d28, 0x10d2f, 0x0002, 0x10d30, 0x10d39, 0x0006,
|
|
200
|
+
0x10d3a, 0x10d3f, 0x0002, 0x10d40, 0x10d49, 0x0006, 0x10d4a, 0x10d68, 0x0001, 0x10d69, 0x10d6d, 0x0008,
|
|
201
|
+
0x10d6e, 0x10d6e, 0x000d, 0x10d6f, 0x10e5f, 0x0001, 0x10e60, 0x10e7e, 0x0006, 0x10e7f, 0x10eaa, 0x0001,
|
|
202
|
+
0x10eab, 0x10eac, 0x0008, 0x10ead, 0x10ebf, 0x0001, 0x10ec0, 0x10ecf, 0x0002, 0x10ed0, 0x10ed8, 0x000d,
|
|
203
|
+
0x10ed9, 0x10ef9, 0x0002, 0x10efa, 0x10eff, 0x0008, 0x10f00, 0x10f2f, 0x0001, 0x10f30, 0x10f45, 0x0002,
|
|
204
|
+
0x10f46, 0x10f50, 0x0008, 0x10f51, 0x10f6f, 0x0002, 0x10f70, 0x10f81, 0x0001, 0x10f82, 0x10f85, 0x0008,
|
|
205
|
+
0x10f86, 0x10fff, 0x0001, 0x11001, 0x11001, 0x0008, 0x11038, 0x11046, 0x0008, 0x11052, 0x11065, 0x000d,
|
|
206
|
+
0x11070, 0x11070, 0x0008, 0x11073, 0x11074, 0x0008, 0x1107f, 0x11081, 0x0008, 0x110b3, 0x110b6, 0x0008,
|
|
207
|
+
0x110b9, 0x110ba, 0x0008, 0x110c2, 0x110c2, 0x0008, 0x11100, 0x11102, 0x0008, 0x11127, 0x1112b, 0x0008,
|
|
208
|
+
0x1112d, 0x11134, 0x0008, 0x11173, 0x11173, 0x0008, 0x11180, 0x11181, 0x0008, 0x111b6, 0x111be, 0x0008,
|
|
209
|
+
0x111c9, 0x111cc, 0x0008, 0x111cf, 0x111cf, 0x0008, 0x1122f, 0x11231, 0x0008, 0x11234, 0x11234, 0x0008,
|
|
210
|
+
0x11236, 0x11237, 0x0008, 0x1123e, 0x1123e, 0x0008, 0x11241, 0x11241, 0x0008, 0x112df, 0x112df, 0x0008,
|
|
211
|
+
0x112e3, 0x112ea, 0x0008, 0x11300, 0x11301, 0x0008, 0x1133b, 0x1133c, 0x0008, 0x11340, 0x11340, 0x0008,
|
|
212
|
+
0x11366, 0x1136c, 0x0008, 0x11370, 0x11374, 0x0008, 0x113bb, 0x113c0, 0x0008, 0x113ce, 0x113ce, 0x0008,
|
|
213
|
+
0x113d0, 0x113d0, 0x0008, 0x113d2, 0x113d2, 0x0008, 0x113e1, 0x113e2, 0x0008, 0x11438, 0x1143f, 0x0008,
|
|
214
|
+
0x11442, 0x11444, 0x0008, 0x11446, 0x11446, 0x0008, 0x1145e, 0x1145e, 0x0008, 0x114b3, 0x114b8, 0x0008,
|
|
215
|
+
0x114ba, 0x114ba, 0x0008, 0x114bf, 0x114c0, 0x0008, 0x114c2, 0x114c3, 0x0008, 0x115b2, 0x115b5, 0x0008,
|
|
216
|
+
0x115bc, 0x115bd, 0x0008, 0x115bf, 0x115c0, 0x0008, 0x115dc, 0x115dd, 0x0008, 0x11633, 0x1163a, 0x0008,
|
|
217
|
+
0x1163d, 0x1163d, 0x0008, 0x1163f, 0x11640, 0x0008, 0x11660, 0x1166c, 0x000d, 0x116ab, 0x116ab, 0x0008,
|
|
218
|
+
0x116ad, 0x116ad, 0x0008, 0x116b0, 0x116b5, 0x0008, 0x116b7, 0x116b7, 0x0008, 0x1171d, 0x1171d, 0x0008,
|
|
219
|
+
0x1171f, 0x1171f, 0x0008, 0x11722, 0x11725, 0x0008, 0x11727, 0x1172b, 0x0008, 0x1182f, 0x11837, 0x0008,
|
|
220
|
+
0x11839, 0x1183a, 0x0008, 0x1193b, 0x1193c, 0x0008, 0x1193e, 0x1193e, 0x0008, 0x11943, 0x11943, 0x0008,
|
|
221
|
+
0x119d4, 0x119d7, 0x0008, 0x119da, 0x119db, 0x0008, 0x119e0, 0x119e0, 0x0008, 0x11a01, 0x11a06, 0x0008,
|
|
222
|
+
0x11a09, 0x11a0a, 0x0008, 0x11a33, 0x11a38, 0x0008, 0x11a3b, 0x11a3e, 0x0008, 0x11a47, 0x11a47, 0x0008,
|
|
223
|
+
0x11a51, 0x11a56, 0x0008, 0x11a59, 0x11a5b, 0x0008, 0x11a8a, 0x11a96, 0x0008, 0x11a98, 0x11a99, 0x0008,
|
|
224
|
+
0x11b60, 0x11b60, 0x0008, 0x11b62, 0x11b64, 0x0008, 0x11b66, 0x11b66, 0x0008, 0x11c30, 0x11c36, 0x0008,
|
|
225
|
+
0x11c38, 0x11c3d, 0x0008, 0x11c92, 0x11ca7, 0x0008, 0x11caa, 0x11cb0, 0x0008, 0x11cb2, 0x11cb3, 0x0008,
|
|
226
|
+
0x11cb5, 0x11cb6, 0x0008, 0x11d31, 0x11d36, 0x0008, 0x11d3a, 0x11d3a, 0x0008, 0x11d3c, 0x11d3d, 0x0008,
|
|
227
|
+
0x11d3f, 0x11d45, 0x0008, 0x11d47, 0x11d47, 0x0008, 0x11d90, 0x11d91, 0x0008, 0x11d95, 0x11d95, 0x0008,
|
|
228
|
+
0x11d97, 0x11d97, 0x0008, 0x11ef3, 0x11ef4, 0x0008, 0x11f00, 0x11f01, 0x0008, 0x11f36, 0x11f3a, 0x0008,
|
|
229
|
+
0x11f40, 0x11f40, 0x0008, 0x11f42, 0x11f42, 0x0008, 0x11f5a, 0x11f5a, 0x0008, 0x11fd5, 0x11fdc, 0x000d,
|
|
230
|
+
0x11fdd, 0x11fe0, 0x0005, 0x11fe1, 0x11ff1, 0x000d, 0x13440, 0x13440, 0x0008, 0x13447, 0x13455, 0x0008,
|
|
231
|
+
0x1611e, 0x16129, 0x0008, 0x1612d, 0x1612f, 0x0008, 0x16af0, 0x16af4, 0x0008, 0x16b30, 0x16b36, 0x0008,
|
|
232
|
+
0x16f4f, 0x16f4f, 0x0008, 0x16f8f, 0x16f92, 0x0008, 0x16fe2, 0x16fe2, 0x000d, 0x16fe4, 0x16fe4, 0x0008,
|
|
233
|
+
0x1bc9d, 0x1bc9e, 0x0008, 0x1bca0, 0x1bca3, 0x0009, 0x1cc00, 0x1ccd5, 0x000d, 0x1ccf0, 0x1ccf9, 0x0003,
|
|
234
|
+
0x1ccfa, 0x1ccfc, 0x000d, 0x1cd00, 0x1ceb3, 0x000d, 0x1ceba, 0x1ced0, 0x000d, 0x1cee0, 0x1cef0, 0x000d,
|
|
235
|
+
0x1cf00, 0x1cf2d, 0x0008, 0x1cf30, 0x1cf46, 0x0008, 0x1d167, 0x1d169, 0x0008, 0x1d173, 0x1d17a, 0x0009,
|
|
236
|
+
0x1d17b, 0x1d182, 0x0008, 0x1d185, 0x1d18b, 0x0008, 0x1d1aa, 0x1d1ad, 0x0008, 0x1d1e9, 0x1d1ea, 0x000d,
|
|
237
|
+
0x1d200, 0x1d241, 0x000d, 0x1d242, 0x1d244, 0x0008, 0x1d245, 0x1d245, 0x000d, 0x1d300, 0x1d356, 0x000d,
|
|
238
|
+
0x1d6c1, 0x1d6c1, 0x000d, 0x1d6db, 0x1d6db, 0x000d, 0x1d6fb, 0x1d6fb, 0x000d, 0x1d715, 0x1d715, 0x000d,
|
|
239
|
+
0x1d735, 0x1d735, 0x000d, 0x1d74f, 0x1d74f, 0x000d, 0x1d76f, 0x1d76f, 0x000d, 0x1d789, 0x1d789, 0x000d,
|
|
240
|
+
0x1d7a9, 0x1d7a9, 0x000d, 0x1d7c3, 0x1d7c3, 0x000d, 0x1d7ce, 0x1d7ff, 0x0003, 0x1da00, 0x1da36, 0x0008,
|
|
241
|
+
0x1da3b, 0x1da6c, 0x0008, 0x1da75, 0x1da75, 0x0008, 0x1da84, 0x1da84, 0x0008, 0x1da9b, 0x1da9f, 0x0008,
|
|
242
|
+
0x1daa1, 0x1daaf, 0x0008, 0x1e000, 0x1e006, 0x0008, 0x1e008, 0x1e018, 0x0008, 0x1e01b, 0x1e021, 0x0008,
|
|
243
|
+
0x1e023, 0x1e024, 0x0008, 0x1e026, 0x1e02a, 0x0008, 0x1e08f, 0x1e08f, 0x0008, 0x1e130, 0x1e136, 0x0008,
|
|
244
|
+
0x1e2ae, 0x1e2ae, 0x0008, 0x1e2ec, 0x1e2ef, 0x0008, 0x1e2ff, 0x1e2ff, 0x0005, 0x1e4ec, 0x1e4ef, 0x0008,
|
|
245
|
+
0x1e5ee, 0x1e5ef, 0x0008, 0x1e6e3, 0x1e6e3, 0x0008, 0x1e6e6, 0x1e6e6, 0x0008, 0x1e6ee, 0x1e6ef, 0x0008,
|
|
246
|
+
0x1e6f5, 0x1e6f5, 0x0008, 0x1e800, 0x1e8cf, 0x0001, 0x1e8d0, 0x1e8d6, 0x0008, 0x1e8d7, 0x1e943, 0x0001,
|
|
247
|
+
0x1e944, 0x1e94a, 0x0008, 0x1e94b, 0x1ec6f, 0x0001, 0x1ec70, 0x1ecbf, 0x0002, 0x1ecc0, 0x1ecff, 0x0001,
|
|
248
|
+
0x1ed00, 0x1ed4f, 0x0002, 0x1ed50, 0x1edff, 0x0001, 0x1ee00, 0x1eeef, 0x0002, 0x1eef0, 0x1eef1, 0x000d,
|
|
249
|
+
0x1eef2, 0x1eeff, 0x0002, 0x1ef00, 0x1efff, 0x0001, 0x1f000, 0x1f02b, 0x000d, 0x1f030, 0x1f093, 0x000d,
|
|
250
|
+
0x1f0a0, 0x1f0ae, 0x000d, 0x1f0b1, 0x1f0bf, 0x000d, 0x1f0c1, 0x1f0cf, 0x000d, 0x1f0d1, 0x1f0f5, 0x000d,
|
|
251
|
+
0x1f100, 0x1f10a, 0x0003, 0x1f10b, 0x1f10f, 0x000d, 0x1f12f, 0x1f12f, 0x000d, 0x1f16a, 0x1f16f, 0x000d,
|
|
252
|
+
0x1f1ad, 0x1f1ad, 0x000d, 0x1f260, 0x1f265, 0x000d, 0x1f300, 0x1f6d8, 0x000d, 0x1f6dc, 0x1f6ec, 0x000d,
|
|
253
|
+
0x1f6f0, 0x1f6fc, 0x000d, 0x1f700, 0x1f7d9, 0x000d, 0x1f7e0, 0x1f7eb, 0x000d, 0x1f7f0, 0x1f7f0, 0x000d,
|
|
254
|
+
0x1f800, 0x1f80b, 0x000d, 0x1f810, 0x1f847, 0x000d, 0x1f850, 0x1f859, 0x000d, 0x1f860, 0x1f887, 0x000d,
|
|
255
|
+
0x1f890, 0x1f8ad, 0x000d, 0x1f8b0, 0x1f8bb, 0x000d, 0x1f8c0, 0x1f8c1, 0x000d, 0x1f8d0, 0x1f8d8, 0x000d,
|
|
256
|
+
0x1f900, 0x1fa57, 0x000d, 0x1fa60, 0x1fa6d, 0x000d, 0x1fa70, 0x1fa7c, 0x000d, 0x1fa80, 0x1fa8a, 0x000d,
|
|
257
|
+
0x1fa8e, 0x1fac6, 0x000d, 0x1fac8, 0x1fac8, 0x000d, 0x1facd, 0x1fadc, 0x000d, 0x1fadf, 0x1faea, 0x000d,
|
|
258
|
+
0x1faef, 0x1faf8, 0x000d, 0x1fb00, 0x1fb92, 0x000d, 0x1fb94, 0x1fbef, 0x000d, 0x1fbf0, 0x1fbf9, 0x0003,
|
|
259
|
+
0x1fbfa, 0x1fbfa, 0x000d, 0x1fffe, 0x1ffff, 0x0009, 0x2fffe, 0x2ffff, 0x0009, 0x3fffe, 0x3ffff, 0x0009,
|
|
260
|
+
0x4fffe, 0x4ffff, 0x0009, 0x5fffe, 0x5ffff, 0x0009, 0x6fffe, 0x6ffff, 0x0009, 0x7fffe, 0x7ffff, 0x0009,
|
|
261
|
+
0x8fffe, 0x8ffff, 0x0009, 0x9fffe, 0x9ffff, 0x0009, 0xafffe, 0xaffff, 0x0009, 0xbfffe, 0xbffff, 0x0009,
|
|
262
|
+
0xcfffe, 0xcffff, 0x0009, 0xdfffe, 0xe00ff, 0x0009, 0xe0100, 0xe01ef, 0x0008, 0xe01f0, 0xe0fff, 0x0009,
|
|
263
|
+
0xefffe, 0xeffff, 0x0009, 0xffffe, 0xfffff, 0x0009, 0x10fffe, 0x10ffff, 0x0009,
|
|
264
|
+
]);
|
|
265
|
+
export const BRACKETS = Object.freeze([
|
|
266
|
+
0x0028, 0x0029, 0x005b, 0x005d, 0x007b, 0x007d, 0x0f3a, 0x0f3b, 0x0f3c, 0x0f3d, 0x169b, 0x169c,
|
|
267
|
+
0x2045, 0x2046, 0x207d, 0x207e, 0x208d, 0x208e, 0x2308, 0x2309, 0x230a, 0x230b, 0x2329, 0x232a,
|
|
268
|
+
0x2768, 0x2769, 0x276a, 0x276b, 0x276c, 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2772, 0x2773,
|
|
269
|
+
0x2774, 0x2775, 0x27c5, 0x27c6, 0x27e6, 0x27e7, 0x27e8, 0x27e9, 0x27ea, 0x27eb, 0x27ec, 0x27ed,
|
|
270
|
+
0x27ee, 0x27ef, 0x2983, 0x2984, 0x2985, 0x2986, 0x2987, 0x2988, 0x2989, 0x298a, 0x298b, 0x298c,
|
|
271
|
+
0x298d, 0x2990, 0x298f, 0x298e, 0x2991, 0x2992, 0x2993, 0x2994, 0x2995, 0x2996, 0x2997, 0x2998,
|
|
272
|
+
0x29d8, 0x29d9, 0x29da, 0x29db, 0x29fc, 0x29fd, 0x2e22, 0x2e23, 0x2e24, 0x2e25, 0x2e26, 0x2e27,
|
|
273
|
+
0x2e28, 0x2e29, 0x2e55, 0x2e56, 0x2e57, 0x2e58, 0x2e59, 0x2e5a, 0x2e5b, 0x2e5c, 0x3008, 0x3009,
|
|
274
|
+
0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3010, 0x3011, 0x3014, 0x3015, 0x3016, 0x3017,
|
|
275
|
+
0x3018, 0x3019, 0x301a, 0x301b, 0xfe59, 0xfe5a, 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0xff08, 0xff09,
|
|
276
|
+
0xff3b, 0xff3d, 0xff5b, 0xff5d, 0xff5f, 0xff60, 0xff62, 0xff63,
|
|
277
|
+
]);
|
|
278
|
+
export const BRACKET_EQUIVALENTS = Object.freeze([
|
|
279
|
+
0x2329, 0x3008, 0x232a, 0x3009,
|
|
280
|
+
]);
|
|
281
|
+
export const MIRRORS = Object.freeze([
|
|
282
|
+
0x0028, 0x0029, 0x0029, 0x0028, 0x003c, 0x003e, 0x003e, 0x003c, 0x005b, 0x005d, 0x005d, 0x005b,
|
|
283
|
+
0x007b, 0x007d, 0x007d, 0x007b, 0x00ab, 0x00bb, 0x00bb, 0x00ab, 0x0f3a, 0x0f3b, 0x0f3b, 0x0f3a,
|
|
284
|
+
0x0f3c, 0x0f3d, 0x0f3d, 0x0f3c, 0x169b, 0x169c, 0x169c, 0x169b, 0x2039, 0x203a, 0x203a, 0x2039,
|
|
285
|
+
0x2045, 0x2046, 0x2046, 0x2045, 0x207d, 0x207e, 0x207e, 0x207d, 0x208d, 0x208e, 0x208e, 0x208d,
|
|
286
|
+
0x2208, 0x220b, 0x2209, 0x220c, 0x220a, 0x220d, 0x220b, 0x2208, 0x220c, 0x2209, 0x220d, 0x220a,
|
|
287
|
+
0x2215, 0x29f5, 0x221f, 0x2bfe, 0x2220, 0x29a3, 0x2221, 0x299b, 0x2222, 0x29a0, 0x2224, 0x2aee,
|
|
288
|
+
0x223c, 0x223d, 0x223d, 0x223c, 0x2243, 0x22cd, 0x2245, 0x224c, 0x224c, 0x2245, 0x2252, 0x2253,
|
|
289
|
+
0x2253, 0x2252, 0x2254, 0x2255, 0x2255, 0x2254, 0x2264, 0x2265, 0x2265, 0x2264, 0x2266, 0x2267,
|
|
290
|
+
0x2267, 0x2266, 0x2268, 0x2269, 0x2269, 0x2268, 0x226a, 0x226b, 0x226b, 0x226a, 0x226e, 0x226f,
|
|
291
|
+
0x226f, 0x226e, 0x2270, 0x2271, 0x2271, 0x2270, 0x2272, 0x2273, 0x2273, 0x2272, 0x2274, 0x2275,
|
|
292
|
+
0x2275, 0x2274, 0x2276, 0x2277, 0x2277, 0x2276, 0x2278, 0x2279, 0x2279, 0x2278, 0x227a, 0x227b,
|
|
293
|
+
0x227b, 0x227a, 0x227c, 0x227d, 0x227d, 0x227c, 0x227e, 0x227f, 0x227f, 0x227e, 0x2280, 0x2281,
|
|
294
|
+
0x2281, 0x2280, 0x2282, 0x2283, 0x2283, 0x2282, 0x2284, 0x2285, 0x2285, 0x2284, 0x2286, 0x2287,
|
|
295
|
+
0x2287, 0x2286, 0x2288, 0x2289, 0x2289, 0x2288, 0x228a, 0x228b, 0x228b, 0x228a, 0x228f, 0x2290,
|
|
296
|
+
0x2290, 0x228f, 0x2291, 0x2292, 0x2292, 0x2291, 0x2298, 0x29b8, 0x22a2, 0x22a3, 0x22a3, 0x22a2,
|
|
297
|
+
0x22a6, 0x2ade, 0x22a8, 0x2ae4, 0x22a9, 0x2ae3, 0x22ab, 0x2ae5, 0x22b0, 0x22b1, 0x22b1, 0x22b0,
|
|
298
|
+
0x22b2, 0x22b3, 0x22b3, 0x22b2, 0x22b4, 0x22b5, 0x22b5, 0x22b4, 0x22b6, 0x22b7, 0x22b7, 0x22b6,
|
|
299
|
+
0x22b8, 0x27dc, 0x22c9, 0x22ca, 0x22ca, 0x22c9, 0x22cb, 0x22cc, 0x22cc, 0x22cb, 0x22cd, 0x2243,
|
|
300
|
+
0x22d0, 0x22d1, 0x22d1, 0x22d0, 0x22d6, 0x22d7, 0x22d7, 0x22d6, 0x22d8, 0x22d9, 0x22d9, 0x22d8,
|
|
301
|
+
0x22da, 0x22db, 0x22db, 0x22da, 0x22dc, 0x22dd, 0x22dd, 0x22dc, 0x22de, 0x22df, 0x22df, 0x22de,
|
|
302
|
+
0x22e0, 0x22e1, 0x22e1, 0x22e0, 0x22e2, 0x22e3, 0x22e3, 0x22e2, 0x22e4, 0x22e5, 0x22e5, 0x22e4,
|
|
303
|
+
0x22e6, 0x22e7, 0x22e7, 0x22e6, 0x22e8, 0x22e9, 0x22e9, 0x22e8, 0x22ea, 0x22eb, 0x22eb, 0x22ea,
|
|
304
|
+
0x22ec, 0x22ed, 0x22ed, 0x22ec, 0x22f0, 0x22f1, 0x22f1, 0x22f0, 0x22f2, 0x22fa, 0x22f3, 0x22fb,
|
|
305
|
+
0x22f4, 0x22fc, 0x22f6, 0x22fd, 0x22f7, 0x22fe, 0x22fa, 0x22f2, 0x22fb, 0x22f3, 0x22fc, 0x22f4,
|
|
306
|
+
0x22fd, 0x22f6, 0x22fe, 0x22f7, 0x2308, 0x2309, 0x2309, 0x2308, 0x230a, 0x230b, 0x230b, 0x230a,
|
|
307
|
+
0x2329, 0x232a, 0x232a, 0x2329, 0x2768, 0x2769, 0x2769, 0x2768, 0x276a, 0x276b, 0x276b, 0x276a,
|
|
308
|
+
0x276c, 0x276d, 0x276d, 0x276c, 0x276e, 0x276f, 0x276f, 0x276e, 0x2770, 0x2771, 0x2771, 0x2770,
|
|
309
|
+
0x2772, 0x2773, 0x2773, 0x2772, 0x2774, 0x2775, 0x2775, 0x2774, 0x27c3, 0x27c4, 0x27c4, 0x27c3,
|
|
310
|
+
0x27c5, 0x27c6, 0x27c6, 0x27c5, 0x27c8, 0x27c9, 0x27c9, 0x27c8, 0x27cb, 0x27cd, 0x27cd, 0x27cb,
|
|
311
|
+
0x27d5, 0x27d6, 0x27d6, 0x27d5, 0x27dc, 0x22b8, 0x27dd, 0x27de, 0x27de, 0x27dd, 0x27e2, 0x27e3,
|
|
312
|
+
0x27e3, 0x27e2, 0x27e4, 0x27e5, 0x27e5, 0x27e4, 0x27e6, 0x27e7, 0x27e7, 0x27e6, 0x27e8, 0x27e9,
|
|
313
|
+
0x27e9, 0x27e8, 0x27ea, 0x27eb, 0x27eb, 0x27ea, 0x27ec, 0x27ed, 0x27ed, 0x27ec, 0x27ee, 0x27ef,
|
|
314
|
+
0x27ef, 0x27ee, 0x2983, 0x2984, 0x2984, 0x2983, 0x2985, 0x2986, 0x2986, 0x2985, 0x2987, 0x2988,
|
|
315
|
+
0x2988, 0x2987, 0x2989, 0x298a, 0x298a, 0x2989, 0x298b, 0x298c, 0x298c, 0x298b, 0x298d, 0x2990,
|
|
316
|
+
0x298e, 0x298f, 0x298f, 0x298e, 0x2990, 0x298d, 0x2991, 0x2992, 0x2992, 0x2991, 0x2993, 0x2994,
|
|
317
|
+
0x2994, 0x2993, 0x2995, 0x2996, 0x2996, 0x2995, 0x2997, 0x2998, 0x2998, 0x2997, 0x299b, 0x2221,
|
|
318
|
+
0x29a0, 0x2222, 0x29a3, 0x2220, 0x29a4, 0x29a5, 0x29a5, 0x29a4, 0x29a8, 0x29a9, 0x29a9, 0x29a8,
|
|
319
|
+
0x29aa, 0x29ab, 0x29ab, 0x29aa, 0x29ac, 0x29ad, 0x29ad, 0x29ac, 0x29ae, 0x29af, 0x29af, 0x29ae,
|
|
320
|
+
0x29b8, 0x2298, 0x29c0, 0x29c1, 0x29c1, 0x29c0, 0x29c4, 0x29c5, 0x29c5, 0x29c4, 0x29cf, 0x29d0,
|
|
321
|
+
0x29d0, 0x29cf, 0x29d1, 0x29d2, 0x29d2, 0x29d1, 0x29d4, 0x29d5, 0x29d5, 0x29d4, 0x29d8, 0x29d9,
|
|
322
|
+
0x29d9, 0x29d8, 0x29da, 0x29db, 0x29db, 0x29da, 0x29e8, 0x29e9, 0x29e9, 0x29e8, 0x29f5, 0x2215,
|
|
323
|
+
0x29f8, 0x29f9, 0x29f9, 0x29f8, 0x29fc, 0x29fd, 0x29fd, 0x29fc, 0x2a2b, 0x2a2c, 0x2a2c, 0x2a2b,
|
|
324
|
+
0x2a2d, 0x2a2e, 0x2a2e, 0x2a2d, 0x2a34, 0x2a35, 0x2a35, 0x2a34, 0x2a3c, 0x2a3d, 0x2a3d, 0x2a3c,
|
|
325
|
+
0x2a64, 0x2a65, 0x2a65, 0x2a64, 0x2a79, 0x2a7a, 0x2a7a, 0x2a79, 0x2a7b, 0x2a7c, 0x2a7c, 0x2a7b,
|
|
326
|
+
0x2a7d, 0x2a7e, 0x2a7e, 0x2a7d, 0x2a7f, 0x2a80, 0x2a80, 0x2a7f, 0x2a81, 0x2a82, 0x2a82, 0x2a81,
|
|
327
|
+
0x2a83, 0x2a84, 0x2a84, 0x2a83, 0x2a85, 0x2a86, 0x2a86, 0x2a85, 0x2a87, 0x2a88, 0x2a88, 0x2a87,
|
|
328
|
+
0x2a89, 0x2a8a, 0x2a8a, 0x2a89, 0x2a8b, 0x2a8c, 0x2a8c, 0x2a8b, 0x2a8d, 0x2a8e, 0x2a8e, 0x2a8d,
|
|
329
|
+
0x2a8f, 0x2a90, 0x2a90, 0x2a8f, 0x2a91, 0x2a92, 0x2a92, 0x2a91, 0x2a93, 0x2a94, 0x2a94, 0x2a93,
|
|
330
|
+
0x2a95, 0x2a96, 0x2a96, 0x2a95, 0x2a97, 0x2a98, 0x2a98, 0x2a97, 0x2a99, 0x2a9a, 0x2a9a, 0x2a99,
|
|
331
|
+
0x2a9b, 0x2a9c, 0x2a9c, 0x2a9b, 0x2a9d, 0x2a9e, 0x2a9e, 0x2a9d, 0x2a9f, 0x2aa0, 0x2aa0, 0x2a9f,
|
|
332
|
+
0x2aa1, 0x2aa2, 0x2aa2, 0x2aa1, 0x2aa6, 0x2aa7, 0x2aa7, 0x2aa6, 0x2aa8, 0x2aa9, 0x2aa9, 0x2aa8,
|
|
333
|
+
0x2aaa, 0x2aab, 0x2aab, 0x2aaa, 0x2aac, 0x2aad, 0x2aad, 0x2aac, 0x2aaf, 0x2ab0, 0x2ab0, 0x2aaf,
|
|
334
|
+
0x2ab1, 0x2ab2, 0x2ab2, 0x2ab1, 0x2ab3, 0x2ab4, 0x2ab4, 0x2ab3, 0x2ab5, 0x2ab6, 0x2ab6, 0x2ab5,
|
|
335
|
+
0x2ab7, 0x2ab8, 0x2ab8, 0x2ab7, 0x2ab9, 0x2aba, 0x2aba, 0x2ab9, 0x2abb, 0x2abc, 0x2abc, 0x2abb,
|
|
336
|
+
0x2abd, 0x2abe, 0x2abe, 0x2abd, 0x2abf, 0x2ac0, 0x2ac0, 0x2abf, 0x2ac1, 0x2ac2, 0x2ac2, 0x2ac1,
|
|
337
|
+
0x2ac3, 0x2ac4, 0x2ac4, 0x2ac3, 0x2ac5, 0x2ac6, 0x2ac6, 0x2ac5, 0x2ac7, 0x2ac8, 0x2ac8, 0x2ac7,
|
|
338
|
+
0x2ac9, 0x2aca, 0x2aca, 0x2ac9, 0x2acb, 0x2acc, 0x2acc, 0x2acb, 0x2acd, 0x2ace, 0x2ace, 0x2acd,
|
|
339
|
+
0x2acf, 0x2ad0, 0x2ad0, 0x2acf, 0x2ad1, 0x2ad2, 0x2ad2, 0x2ad1, 0x2ad3, 0x2ad4, 0x2ad4, 0x2ad3,
|
|
340
|
+
0x2ad5, 0x2ad6, 0x2ad6, 0x2ad5, 0x2ade, 0x22a6, 0x2ae3, 0x22a9, 0x2ae4, 0x22a8, 0x2ae5, 0x22ab,
|
|
341
|
+
0x2aec, 0x2aed, 0x2aed, 0x2aec, 0x2aee, 0x2224, 0x2af7, 0x2af8, 0x2af8, 0x2af7, 0x2af9, 0x2afa,
|
|
342
|
+
0x2afa, 0x2af9, 0x2bfe, 0x221f, 0x2e02, 0x2e03, 0x2e03, 0x2e02, 0x2e04, 0x2e05, 0x2e05, 0x2e04,
|
|
343
|
+
0x2e09, 0x2e0a, 0x2e0a, 0x2e09, 0x2e0c, 0x2e0d, 0x2e0d, 0x2e0c, 0x2e1c, 0x2e1d, 0x2e1d, 0x2e1c,
|
|
344
|
+
0x2e20, 0x2e21, 0x2e21, 0x2e20, 0x2e22, 0x2e23, 0x2e23, 0x2e22, 0x2e24, 0x2e25, 0x2e25, 0x2e24,
|
|
345
|
+
0x2e26, 0x2e27, 0x2e27, 0x2e26, 0x2e28, 0x2e29, 0x2e29, 0x2e28, 0x2e55, 0x2e56, 0x2e56, 0x2e55,
|
|
346
|
+
0x2e57, 0x2e58, 0x2e58, 0x2e57, 0x2e59, 0x2e5a, 0x2e5a, 0x2e59, 0x2e5b, 0x2e5c, 0x2e5c, 0x2e5b,
|
|
347
|
+
0x3008, 0x3009, 0x3009, 0x3008, 0x300a, 0x300b, 0x300b, 0x300a, 0x300c, 0x300d, 0x300d, 0x300c,
|
|
348
|
+
0x300e, 0x300f, 0x300f, 0x300e, 0x3010, 0x3011, 0x3011, 0x3010, 0x3014, 0x3015, 0x3015, 0x3014,
|
|
349
|
+
0x3016, 0x3017, 0x3017, 0x3016, 0x3018, 0x3019, 0x3019, 0x3018, 0x301a, 0x301b, 0x301b, 0x301a,
|
|
350
|
+
0xfe59, 0xfe5a, 0xfe5a, 0xfe59, 0xfe5b, 0xfe5c, 0xfe5c, 0xfe5b, 0xfe5d, 0xfe5e, 0xfe5e, 0xfe5d,
|
|
351
|
+
0xfe64, 0xfe65, 0xfe65, 0xfe64, 0xff08, 0xff09, 0xff09, 0xff08, 0xff1c, 0xff1e, 0xff1e, 0xff1c,
|
|
352
|
+
0xff3b, 0xff3d, 0xff3d, 0xff3b, 0xff5b, 0xff5d, 0xff5d, 0xff5b, 0xff5f, 0xff60, 0xff60, 0xff5f,
|
|
353
|
+
0xff62, 0xff63, 0xff63, 0xff62,
|
|
354
|
+
]);
|
package/src/bidi.mjs
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// src/bidi.mjs — the Unicode Bidirectional Algorithm (UAX #9), version 17.0.0, as the reader lays out a line of text for
|
|
2
|
+
// a terminal that draws text in the order it is written (R1, S377: Alacritty and VS Code's terminal do), and, since
|
|
3
|
+
// round 6 (Y1), for every terminal: one that lays bidirectional text out itself, as Konsole does, gets the line inside a
|
|
4
|
+
// left-to-right override (src/screen.mjs). Pure functions over code points; the data is
|
|
5
|
+
// src/bidi-table.mjs, generated from the Unicode Character Database (scripts/bidi-table.mjs).
|
|
6
|
+
//
|
|
7
|
+
// What is implemented: the paragraph's level by P2 and P3 (its first strong character, skipping an isolate; none: left
|
|
8
|
+
// to right), or given (HL1); X9, which removes BN (and the embeddings and overrides); the implicit algorithm, W1 to W7,
|
|
9
|
+
// N0 with the paired brackets (BD16, a stack of 63, the brackets matched by their canonical equivalents), N1, N2, I1 and
|
|
10
|
+
// I2, over one isolating run sequence: the paragraph's levels, resolved once for the whole paragraph; then, for each line
|
|
11
|
+
// the paragraph is wrapped into, L1 and L2 (section 3.4: a line's levels are the paragraph's, never resolved again for
|
|
12
|
+
// the line alone); L4's mirrored glyphs are given by mirrorOf. The explicit formatting characters never act: the reader
|
|
13
|
+
// shows them as visible escapes (R.F5), so that none reaches this layout raw; if one does, an embedding, override or pop
|
|
14
|
+
// is removed as X9 removes it, and an isolate's initiator or PDI is a neutral. Checked against Unicode's
|
|
15
|
+
// BidiCharacterTest.txt (every case without an explicit formatting character) and against GNU FriBidi, its CLI for
|
|
16
|
+
// single lines and its library for wrapped paragraphs (test/bidi.test.mjs).
|
|
17
|
+
//
|
|
18
|
+
// One higher-level protocol (HL4, with HL2 inside it) is the caller's: a stretch of a paragraph laid out on its own, as an
|
|
19
|
+
// isolate would be, stands in it as one character of the class ISO (src/text.mjs: a path or a URL).
|
|
20
|
+
import { BRACKETS, BRACKET_EQUIVALENTS, CLASSES, CLASS_RANGES, MIRRORS } from './bidi-table.mjs';
|
|
21
|
+
|
|
22
|
+
export const L = 0, R = 1, AL = 2, EN = 3, ES = 4, ET = 5, AN = 6, CS = 7, NSM = 8, BN = 9, B = 10, S = 11, WS = 12, ON = 13;
|
|
23
|
+
export const LRE = 14, LRO = 15, RLE = 16, RLO = 17, PDF = 18, LRI = 19, RLI = 20, FSI = 21, PDI = 22;
|
|
24
|
+
/** Not a Unicode class: a stretch laid out on its own (HL4), standing in the line as an isolate stands there. */
|
|
25
|
+
export const ISO = 23;
|
|
26
|
+
const NAMES = ['L', 'R', 'AL', 'EN', 'ES', 'ET', 'AN', 'CS', 'NSM', 'BN', 'B', 'S', 'WS', 'ON', 'LRE', 'LRO', 'RLE', 'RLO', 'PDF', 'LRI', 'RLI', 'FSI', 'PDI'];
|
|
27
|
+
if (NAMES.join() !== CLASSES.join()) throw new Error('src/bidi-table.mjs numbers the classes otherwise than src/bidi.mjs');
|
|
28
|
+
|
|
29
|
+
// the classes of the Basic Multilingual Plane, at hand; the rest by a binary search of the ranges
|
|
30
|
+
const BMP = new Uint8Array(0x10000);
|
|
31
|
+
for (let i = 0; i < CLASS_RANGES.length && CLASS_RANGES[i] <= 0xffff; i += 3) BMP.fill(CLASS_RANGES[i + 2], CLASS_RANGES[i], Math.min(CLASS_RANGES[i + 1], 0xffff) + 1);
|
|
32
|
+
|
|
33
|
+
/** A code point's Bidi_Class, as a number (L, R, AL, ...). */
|
|
34
|
+
export function classOf(cp) {
|
|
35
|
+
if (cp <= 0xffff) return BMP[cp];
|
|
36
|
+
let lo = 0, hi = CLASS_RANGES.length / 3 - 1;
|
|
37
|
+
while (lo <= hi) {
|
|
38
|
+
const mid = (lo + hi) >> 1, a = CLASS_RANGES[3 * mid], b = CLASS_RANGES[3 * mid + 1];
|
|
39
|
+
if (cp < a) hi = mid - 1; else if (cp > b) lo = mid + 1; else return CLASS_RANGES[3 * mid + 2];
|
|
40
|
+
}
|
|
41
|
+
return L;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Each character's class, by code unit (W1, round 4: a paragraph's characters, classed at once): at the first unit of a
|
|
45
|
+
* surrogate pair its code point's, at the second BN, which X9 passes over as it passes BN over; a lone surrogate's own. */
|
|
46
|
+
export function classesOf(s) {
|
|
47
|
+
const n = s.length, out = new Uint8Array(n);
|
|
48
|
+
for (let i = 0; i < n; i++) {
|
|
49
|
+
const c = s.charCodeAt(i);
|
|
50
|
+
if (c >= 0xd800 && c <= 0xdbff && i + 1 < n) {
|
|
51
|
+
const d = s.charCodeAt(i + 1);
|
|
52
|
+
if (d >= 0xdc00 && d <= 0xdfff) { out[i] = classOf(((c - 0xd800) << 10) + (d - 0xdc00) + 0x10000); out[++i] = BN; continue; }
|
|
53
|
+
}
|
|
54
|
+
out[i] = BMP[c];
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const OPENS = new Map(), CLOSES = new Map(), EQUIV = new Map(), MIRROR = new Map();
|
|
60
|
+
for (let i = 0; i < BRACKETS.length; i += 2) { OPENS.set(BRACKETS[i], BRACKETS[i + 1]); CLOSES.set(BRACKETS[i + 1], BRACKETS[i]); }
|
|
61
|
+
for (let i = 0; i < BRACKET_EQUIVALENTS.length; i += 2) EQUIV.set(BRACKET_EQUIVALENTS[i], BRACKET_EQUIVALENTS[i + 1]);
|
|
62
|
+
for (let i = 0; i < MIRRORS.length; i += 2) MIRROR.set(MIRRORS[i], MIRRORS[i + 1]);
|
|
63
|
+
const canonical = (cp) => EQUIV.get(cp) ?? cp;
|
|
64
|
+
|
|
65
|
+
/** The glyph a code point is drawn with at an odd (right-to-left) level (L4), by Bidi_Mirroring_Glyph: itself when it
|
|
66
|
+
* has none. */
|
|
67
|
+
export const mirrorOf = (cp) => MIRROR.get(cp) ?? cp;
|
|
68
|
+
|
|
69
|
+
const isStrong = (c) => c === L || c === R || c === AL;
|
|
70
|
+
/** The classes X9 removes, and the neutral and isolate types N1 and N2 resolve (NI), as tables by class: a paragraph's
|
|
71
|
+
* levels are resolved over all its characters at once (W1, round 4: R's record is a paragraph of 4,000,000), each looked up. */
|
|
72
|
+
const REMOVED = new Uint8Array(24), NI = new Uint8Array(24);
|
|
73
|
+
for (const c of [BN, LRE, LRO, RLE, RLO, PDF]) REMOVED[c] = 1;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The paragraph's level by P2 and P3: 0 when its first strong character (L) is left to right, or it has none; 1 when it
|
|
77
|
+
* is R or AL. An isolate's content is skipped (an initiator to its PDI, or the paragraph's end), and so is a stretch the
|
|
78
|
+
* caller lays out on its own (ISO). `classes`: each code point's class.
|
|
79
|
+
*/
|
|
80
|
+
export function paragraphLevel(classes, from = 0, to = classes.length) {
|
|
81
|
+
let depth = 0;
|
|
82
|
+
for (let i = from; i < to; i++) {
|
|
83
|
+
const c = classes[i];
|
|
84
|
+
if (c === LRI || c === RLI || c === FSI) depth++;
|
|
85
|
+
else if (c === PDI) { if (depth > 0) depth--; }
|
|
86
|
+
else if (depth === 0 && isStrong(c)) return c === L ? 0 : 1;
|
|
87
|
+
}
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The type a resolved class gives N0, N1 and N2: L, or R for R, EN and AN; -1 for a neutral. */
|
|
92
|
+
const strongOf = (c) => (c === L ? L : c === R || c === EN || c === AN ? R : -1);
|
|
93
|
+
for (const c of [B, S, WS, ON, LRI, RLI, FSI, PDI, ISO]) NI[c] = 1;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The resolved levels of one paragraph without explicit embeddings: X9, W1 to W7, N0 to N2, I1 and I2. `classes`: each
|
|
97
|
+
* character's class (classOf, or ISO where the caller lays a stretch out on its own; a place the caller marks BN is
|
|
98
|
+
* passed over as X9 passes BN over); `cps`: the code points, an array beside `classes`, or a string whose code unit i
|
|
99
|
+
* begins the character of classes[i] (its code point is read there: the caller marks the second unit of a surrogate
|
|
100
|
+
* pair BN); `level`: the paragraph's level (paragraphLevel, or given). Returns an Int8Array of levels, -1 where X9
|
|
101
|
+
* removed the character.
|
|
102
|
+
*/
|
|
103
|
+
export function resolveLevels(cps, classes, level) {
|
|
104
|
+
const n = classes.length, levels = new Int8Array(n);
|
|
105
|
+
const cpAt = typeof cps === 'string' ? (i) => cps.codePointAt(i) : (i) => cps[i];
|
|
106
|
+
// the isolating run sequence: every character X9 keeps, all at the paragraph's level; idx, where each is (null when X9
|
|
107
|
+
// removes none: each is where it is)
|
|
108
|
+
let m = 0;
|
|
109
|
+
for (let i = 0; i < n; i++) if (!REMOVED[classes[i]]) m++;
|
|
110
|
+
let idx = null, t;
|
|
111
|
+
if (m === n) t = new Uint8Array(classes);
|
|
112
|
+
else {
|
|
113
|
+
levels.fill(-1);
|
|
114
|
+
idx = new Int32Array(m); t = new Uint8Array(m);
|
|
115
|
+
for (let i = 0, k = 0; i < n; i++) if (!REMOVED[classes[i]]) { idx[k] = i; t[k++] = classes[i]; }
|
|
116
|
+
}
|
|
117
|
+
const e = level & 1 ? R : L, sos = e, eos = e;
|
|
118
|
+
// W1: a nonspacing mark takes the type before it (ON after an isolate's initiator or PDI); sos at the start
|
|
119
|
+
for (let k = 0; k < m; k++) {
|
|
120
|
+
if (t[k] !== NSM) continue;
|
|
121
|
+
const p = k ? t[k - 1] : sos;
|
|
122
|
+
t[k] = p === LRI || p === RLI || p === FSI || p === PDI || p === ISO ? ON : p;
|
|
123
|
+
}
|
|
124
|
+
// W2: a European number after Arabic letters (the last strong type before it) is an Arabic number; W3: AL is R (once
|
|
125
|
+
// passed, as W2 has read it)
|
|
126
|
+
for (let k = 0, last = sos; k < m; k++) {
|
|
127
|
+
const c = t[k];
|
|
128
|
+
if (c === L || c === R) last = c;
|
|
129
|
+
else if (c === AL) { last = AL; t[k] = R; }
|
|
130
|
+
else if (c === EN && last === AL) t[k] = AN;
|
|
131
|
+
}
|
|
132
|
+
// W4: one separator between two numbers of a kind it joins
|
|
133
|
+
for (let k = 1; k < m - 1; k++) {
|
|
134
|
+
if (t[k] === ES && t[k - 1] === EN && t[k + 1] === EN) t[k] = EN;
|
|
135
|
+
else if (t[k] === CS && t[k - 1] === EN && t[k + 1] === EN) t[k] = EN;
|
|
136
|
+
else if (t[k] === CS && t[k - 1] === AN && t[k + 1] === AN) t[k] = AN;
|
|
137
|
+
}
|
|
138
|
+
// W5: terminators next to a European number are European numbers
|
|
139
|
+
for (let k = 0; k < m;) {
|
|
140
|
+
if (t[k] !== ET) { k++; continue; }
|
|
141
|
+
let j = k;
|
|
142
|
+
while (j < m && t[j] === ET) j++;
|
|
143
|
+
if ((k > 0 && t[k - 1] === EN) || (j < m && t[j] === EN)) for (let x = k; x < j; x++) t[x] = EN;
|
|
144
|
+
k = j;
|
|
145
|
+
}
|
|
146
|
+
// W6: the separators and terminators left are neutrals; W7: a European number after L (or sos L) is L (W6 makes no
|
|
147
|
+
// strong type, so one pass does both)
|
|
148
|
+
for (let k = 0, last = sos; k < m; k++) {
|
|
149
|
+
const c = t[k];
|
|
150
|
+
if (c === ES || c === ET || c === CS) t[k] = ON;
|
|
151
|
+
else if (c === L || c === R) last = c;
|
|
152
|
+
else if (c === EN && last === L) t[k] = L;
|
|
153
|
+
}
|
|
154
|
+
// N0: paired brackets (BD16), in the order of their openings
|
|
155
|
+
const pairs = [], stack = []; // the stack: two numbers an entry, a closing bracket and where its opening is
|
|
156
|
+
for (let k = 0; k < m; k++) {
|
|
157
|
+
if (t[k] !== ON) continue;
|
|
158
|
+
const cp = cpAt(idx ? idx[k] : k);
|
|
159
|
+
const closing = OPENS.get(cp);
|
|
160
|
+
if (closing !== undefined) {
|
|
161
|
+
if (stack.length === 2 * 63) break; // no room for a 64th: BD16 stops for the rest of the sequence
|
|
162
|
+
stack.push(canonical(closing), k);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (!CLOSES.has(cp)) continue;
|
|
166
|
+
const c = canonical(cp);
|
|
167
|
+
for (let j = stack.length - 2; j >= 0; j -= 2) {
|
|
168
|
+
if (stack[j] === c) { pairs.push(stack[j + 1], k); stack.length = j; break; }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const order = [];
|
|
172
|
+
for (let i = 0; i < pairs.length; i += 2) order.push(i);
|
|
173
|
+
order.sort((x, y) => pairs[x] - pairs[y]);
|
|
174
|
+
const opp = e === L ? R : L;
|
|
175
|
+
for (const i of order) {
|
|
176
|
+
const o = pairs[i], c = pairs[i + 1];
|
|
177
|
+
let found = -1;
|
|
178
|
+
for (let k = o + 1; k < c; k++) {
|
|
179
|
+
const d = strongOf(t[k]);
|
|
180
|
+
if (d === e) { found = e; break; }
|
|
181
|
+
if (d === opp) found = opp;
|
|
182
|
+
}
|
|
183
|
+
if (found < 0) continue; // no strong type inside: the brackets stay neutral
|
|
184
|
+
let to = e;
|
|
185
|
+
if (found === opp) {
|
|
186
|
+
let before = sos;
|
|
187
|
+
for (let k = o - 1; k >= 0; k--) { const d = strongOf(t[k]); if (d >= 0) { before = d; break; } }
|
|
188
|
+
to = before === opp ? opp : e;
|
|
189
|
+
}
|
|
190
|
+
t[o] = to; t[c] = to;
|
|
191
|
+
// the nonspacing marks after each bracket (W1 made them ON) take its new type
|
|
192
|
+
for (const b of [o, c]) for (let k = b + 1; k < m && classes[idx ? idx[k] : k] === NSM; k++) t[k] = to;
|
|
193
|
+
}
|
|
194
|
+
// N1, N2: a run of neutrals between two strong types of one direction takes it; else the embedding direction
|
|
195
|
+
for (let k = 0; k < m;) {
|
|
196
|
+
if (!NI[t[k]]) { k++; continue; }
|
|
197
|
+
let j = k;
|
|
198
|
+
while (j < m && NI[t[j]]) j++;
|
|
199
|
+
const before = k ? strongOf(t[k - 1]) : sos, after = j < m ? strongOf(t[j]) : eos;
|
|
200
|
+
for (let x = k, v = before === after ? before : e; x < j; x++) t[x] = v;
|
|
201
|
+
k = j;
|
|
202
|
+
}
|
|
203
|
+
// I1, I2
|
|
204
|
+
for (let k = 0; k < m; k++) {
|
|
205
|
+
const c = t[k];
|
|
206
|
+
levels[idx ? idx[k] : k] = level & 1 ? (c === L || c === EN || c === AN ? level + 1 : level) : c === R ? level + 1 : c === AN || c === EN ? level + 2 : level;
|
|
207
|
+
}
|
|
208
|
+
return levels;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* L1 for one line [from, to) of a paragraph: a segment or paragraph separator, the whitespace and isolate formatting
|
|
213
|
+
* characters before it, and those at the line's end, take the paragraph's level (characters X9 removed are passed
|
|
214
|
+
* over, and keep -1). A stretch laid out on its own (ISO) is not one of them: it stands for an isolate's initiator, its
|
|
215
|
+
* content and its PDI, and only the PDI, which is never drawn, would take the paragraph's level; where the content is
|
|
216
|
+
* drawn follows the initiator's level, which L1 leaves as it was (GNU FriBidi's library, the content between LRI and PDI
|
|
217
|
+
* at a line's end: S378). Changes `levels` in place.
|
|
218
|
+
*/
|
|
219
|
+
export function lineLevels(classes, levels, level, from = 0, to = classes.length) {
|
|
220
|
+
const ws = (c) => c === WS || c === LRI || c === RLI || c === FSI || c === PDI;
|
|
221
|
+
let trailing = true;
|
|
222
|
+
for (let i = to - 1; i >= from; i--) {
|
|
223
|
+
const c = classes[i];
|
|
224
|
+
if (levels[i] < 0) continue;
|
|
225
|
+
if (c === S || c === B) { levels[i] = level; trailing = true; continue; }
|
|
226
|
+
if (trailing && ws(c)) { levels[i] = level; continue; }
|
|
227
|
+
trailing = false;
|
|
228
|
+
}
|
|
229
|
+
return levels;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* L2: the indices of [from, to) in visual order, left to right: from the highest level to the lowest odd one, every run
|
|
234
|
+
* at that level or higher reversed. Characters at level -1 (X9) are left out.
|
|
235
|
+
*/
|
|
236
|
+
export function visualOrder(levels, from = 0, to = levels.length) {
|
|
237
|
+
const out = [];
|
|
238
|
+
let hi = -1, lo = 127;
|
|
239
|
+
for (let i = from; i < to; i++) { const v = levels[i]; if (v < 0) continue; out.push(i); if (v > hi) hi = v; if (v < lo) lo = v; }
|
|
240
|
+
if (lo % 2 === 0) lo++;
|
|
241
|
+
for (let v = hi; v >= lo; v--) {
|
|
242
|
+
for (let k = 0; k < out.length;) {
|
|
243
|
+
if (levels[out[k]] < v) { k++; continue; }
|
|
244
|
+
let j = k;
|
|
245
|
+
while (j < out.length && levels[out[j]] >= v) j++;
|
|
246
|
+
for (let a = k, b = j - 1; a < b; a++, b--) { const x = out[a]; out[a] = out[b]; out[b] = x; }
|
|
247
|
+
k = j;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return out;
|
|
251
|
+
}
|