pdf-parser.js 5.2.30 → 5.3.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.
Files changed (189) hide show
  1. package/dist/{afm-widths-BHD2HZIL.cjs → afm-widths-C6U0SQj9.cjs} +5 -1448
  2. package/dist/{afm-widths-B_IGbGky.js → afm-widths-p3UfaXme.js} +3 -1398
  3. package/dist/afm-widths.cjs +1 -1
  4. package/dist/afm-widths.js +1 -1
  5. package/dist/annotations.d.cts +3 -3
  6. package/dist/annotations.d.ts +3 -3
  7. package/dist/attachments.d.cts +2 -2
  8. package/dist/attachments.d.ts +2 -2
  9. package/dist/builtin-encoding.cjs +4 -3
  10. package/dist/builtin-encoding.js +2 -1
  11. package/dist/cmap.d.cts +1 -1
  12. package/dist/cmap.d.ts +1 -1
  13. package/dist/content-read.d.cts +1 -1
  14. package/dist/content-read.d.ts +1 -1
  15. package/dist/content-write.cjs +1 -1
  16. package/dist/content-write.d.cts +1 -1
  17. package/dist/content-write.d.ts +1 -1
  18. package/dist/content-write.js +1 -1
  19. package/dist/diagnostics-C9FxfZ6H.d.cts +22 -0
  20. package/dist/diagnostics-C9FxfZ6H.d.ts +22 -0
  21. package/dist/diagnostics.d.cts +1 -21
  22. package/dist/diagnostics.d.ts +1 -21
  23. package/dist/document.d.cts +1 -1
  24. package/dist/document.d.ts +1 -1
  25. package/dist/{embedded-font-ByD7ZiQS.d.ts → embedded-font-CQZbTTDM.d.ts} +1 -1
  26. package/dist/{embedded-font-DgVBedw6.d.cts → embedded-font-CqePfvrl.d.cts} +1 -1
  27. package/dist/embedded-font-write.d.cts +1 -1
  28. package/dist/embedded-font-write.d.ts +1 -1
  29. package/dist/embedded-font.cjs +2 -2
  30. package/dist/embedded-font.d.cts +1 -1
  31. package/dist/embedded-font.d.ts +1 -1
  32. package/dist/embedded-font.js +2 -2
  33. package/dist/encoding-glyph-unicode.cjs +353 -0
  34. package/dist/encoding-glyph-unicode.d.cts +4 -0
  35. package/dist/encoding-glyph-unicode.d.ts +4 -0
  36. package/dist/encoding-glyph-unicode.js +352 -0
  37. package/dist/encoding-standard-tables.cjs +531 -0
  38. package/dist/encoding-standard-tables.d.cts +7 -0
  39. package/dist/encoding-standard-tables.d.ts +7 -0
  40. package/dist/encoding-standard-tables.js +527 -0
  41. package/dist/encoding-symbol-tables.cjs +531 -0
  42. package/dist/encoding-symbol-tables.d.cts +7 -0
  43. package/dist/encoding-symbol-tables.d.ts +7 -0
  44. package/dist/encoding-symbol-tables.js +527 -0
  45. package/dist/encoding.cjs +1 -9
  46. package/dist/encoding.d.cts +1 -9
  47. package/dist/encoding.d.ts +1 -9
  48. package/dist/encoding.js +2 -2
  49. package/dist/encrypt.d.cts +1 -1
  50. package/dist/encrypt.d.ts +1 -1
  51. package/dist/filters.d.cts +1 -1
  52. package/dist/filters.d.ts +1 -1
  53. package/dist/font-read.cjs +4 -3
  54. package/dist/font-read.d.cts +2 -2
  55. package/dist/font-read.d.ts +2 -2
  56. package/dist/font-read.js +2 -1
  57. package/dist/font-registry.d.cts +1 -1
  58. package/dist/font-registry.d.ts +1 -1
  59. package/dist/form.d.cts +2 -2
  60. package/dist/form.d.ts +2 -2
  61. package/dist/gdef-table-D0Hzn4KD.d.cts +15 -0
  62. package/dist/gdef-table-DL0V8wEZ.d.ts +15 -0
  63. package/dist/gdef-table.d.cts +1 -14
  64. package/dist/gdef-table.d.ts +1 -14
  65. package/dist/glyf-contours.d.cts +12 -1
  66. package/dist/glyf-contours.d.ts +12 -1
  67. package/dist/gsub-context.cjs +13 -0
  68. package/dist/gsub-context.d.cts +34 -0
  69. package/dist/gsub-context.d.ts +34 -0
  70. package/dist/gsub-context.js +2 -0
  71. package/dist/gsub-table-BDpJWqpf.d.ts +52 -0
  72. package/dist/gsub-table-D6niKeLi.js +556 -0
  73. package/dist/gsub-table-DW7Wmi9V.d.cts +52 -0
  74. package/dist/gsub-table-hFfYmf1W.cjs +741 -0
  75. package/dist/gsub-table.cjs +21 -556
  76. package/dist/gsub-table.d.cts +2 -2
  77. package/dist/gsub-table.d.ts +2 -2
  78. package/dist/gsub-table.js +2 -554
  79. package/dist/images-read.d.cts +2 -2
  80. package/dist/images-read.d.ts +2 -2
  81. package/dist/index.cjs +6 -6
  82. package/dist/index.d.cts +2 -2
  83. package/dist/index.d.ts +2 -2
  84. package/dist/index.js +6 -6
  85. package/dist/interpret-CqXdXgkY.cjs +712 -0
  86. package/dist/interpret-aWWhdIzr.js +677 -0
  87. package/dist/interpret-colors.cjs +6 -0
  88. package/dist/interpret-colors.d.cts +9 -0
  89. package/dist/interpret-colors.d.ts +9 -0
  90. package/dist/interpret-colors.js +2 -0
  91. package/dist/interpret-marked.cjs +25 -0
  92. package/dist/interpret-marked.d.cts +11 -0
  93. package/dist/interpret-marked.d.ts +11 -0
  94. package/dist/interpret-marked.js +23 -0
  95. package/dist/interpret-shapes.cjs +212 -0
  96. package/dist/interpret-shapes.d.cts +32 -0
  97. package/dist/interpret-shapes.d.ts +32 -0
  98. package/dist/interpret-shapes.js +199 -0
  99. package/dist/interpret-types.cjs +0 -0
  100. package/dist/interpret-types.d.cts +123 -0
  101. package/dist/interpret-types.d.ts +123 -0
  102. package/dist/interpret-types.js +0 -0
  103. package/dist/interpret.cjs +3 -887
  104. package/dist/interpret.d.cts +5 -116
  105. package/dist/interpret.d.ts +5 -116
  106. package/dist/interpret.js +2 -887
  107. package/dist/math-font.cjs +1 -1
  108. package/dist/math-font.js +1 -1
  109. package/dist/measure.cjs +1 -1
  110. package/dist/measure.js +1 -1
  111. package/dist/names.d.cts +2 -2
  112. package/dist/names.d.ts +2 -2
  113. package/dist/navigation.d.cts +2 -2
  114. package/dist/navigation.d.ts +2 -2
  115. package/dist/optional-content.d.cts +2 -2
  116. package/dist/optional-content.d.ts +2 -2
  117. package/dist/ot-layout-common-BcsGRFBS.d.cts +10 -0
  118. package/dist/ot-layout-common-BcsGRFBS.d.ts +10 -0
  119. package/dist/ot-layout-common.d.cts +1 -9
  120. package/dist/ot-layout-common.d.ts +1 -9
  121. package/dist/parse.d.cts +1 -1
  122. package/dist/parse.d.ts +1 -1
  123. package/dist/predictors.d.cts +1 -1
  124. package/dist/predictors.d.ts +1 -1
  125. package/dist/raster-Cdm3idP_.js +794 -0
  126. package/dist/raster-EG2KYRZ0.cjs +829 -0
  127. package/dist/raster-text.cjs +5 -0
  128. package/dist/raster-text.d.cts +20 -0
  129. package/dist/raster-text.d.ts +20 -0
  130. package/dist/raster-text.js +2 -0
  131. package/dist/raster.cjs +4 -795
  132. package/dist/raster.d.cts +17 -6
  133. package/dist/raster.d.ts +17 -6
  134. package/dist/raster.js +2 -792
  135. package/dist/read-convert.cjs +310 -0
  136. package/dist/read-convert.d.cts +58 -0
  137. package/dist/read-convert.d.ts +58 -0
  138. package/dist/read-convert.js +295 -0
  139. package/dist/read.cjs +5 -293
  140. package/dist/read.d.cts +1 -1
  141. package/dist/read.d.ts +1 -1
  142. package/dist/read.js +4 -292
  143. package/dist/structure.d.cts +2 -2
  144. package/dist/structure.d.ts +2 -2
  145. package/dist/winansi.cjs +1 -1
  146. package/dist/winansi.js +1 -1
  147. package/dist/write-annotations.cjs +132 -0
  148. package/dist/write-annotations.d.cts +29 -0
  149. package/dist/write-annotations.d.ts +29 -0
  150. package/dist/write-annotations.js +121 -0
  151. package/dist/write-font-objects.cjs +76 -0
  152. package/dist/write-font-objects.d.cts +35 -0
  153. package/dist/write-font-objects.d.ts +35 -0
  154. package/dist/write-font-objects.js +75 -0
  155. package/dist/write-form.cjs +91 -0
  156. package/dist/write-form.d.cts +19 -0
  157. package/dist/write-form.d.ts +19 -0
  158. package/dist/write-form.js +89 -0
  159. package/dist/write-images.cjs +148 -0
  160. package/dist/write-images.d.cts +25 -0
  161. package/dist/write-images.d.ts +25 -0
  162. package/dist/write-images.js +140 -0
  163. package/dist/write-outline.cjs +46 -0
  164. package/dist/write-outline.d.cts +18 -0
  165. package/dist/write-outline.d.ts +18 -0
  166. package/dist/write-outline.js +45 -0
  167. package/dist/write-page-emit.cjs +97 -0
  168. package/dist/write-page-emit.d.cts +63 -0
  169. package/dist/write-page-emit.d.ts +63 -0
  170. package/dist/write-page-emit.js +96 -0
  171. package/dist/write-pages.cjs +37 -0
  172. package/dist/write-pages.d.cts +21 -0
  173. package/dist/write-pages.d.ts +21 -0
  174. package/dist/write-pages.js +36 -0
  175. package/dist/write-strings.cjs +41 -0
  176. package/dist/write-strings.d.cts +9 -0
  177. package/dist/write-strings.d.ts +9 -0
  178. package/dist/write-strings.js +37 -0
  179. package/dist/write.cjs +53 -553
  180. package/dist/write.d.cts +1 -1
  181. package/dist/write.d.ts +1 -1
  182. package/dist/write.js +49 -549
  183. package/dist/xref.d.cts +1 -1
  184. package/dist/xref.d.ts +1 -1
  185. package/package.json +1 -1
  186. package/dist/glyf-contours-B1PsI9oA.d.ts +0 -13
  187. package/dist/glyf-contours-NHBpgks-.d.cts +0 -13
  188. package/dist/gsub-table-Bm9kSMzk.d.cts +0 -16
  189. package/dist/gsub-table-CdfESH2-.d.ts +0 -16
@@ -0,0 +1,556 @@
1
+ import { hasBytes, i16, sfntTableBytes, u16, u32 } from "./sfnt.js";
2
+ import { parseClassDef, parseCoverage } from "./ot-layout-common.js";
3
+ import { parseGdefTable } from "./gdef-table.js";
4
+ //#region src/gsub-context.ts
5
+ function matchContextualRule(slots, index, skip, backtrack, inputTests, lookahead) {
6
+ const inputSlots = [index];
7
+ let cursor = index;
8
+ for (const test of inputTests) {
9
+ const next = nextVisibleSlot(slots, cursor + 1, skip);
10
+ if (next === void 0 || !test(slots[next].glyphId)) return;
11
+ inputSlots.push(next);
12
+ cursor = next;
13
+ }
14
+ let back = index;
15
+ for (let b = backtrack.length - 1; b >= 0; b--) {
16
+ const previous = prevVisibleSlot(slots, back, skip);
17
+ if (previous === void 0 || !backtrack[b](slots[previous].glyphId)) return;
18
+ back = previous;
19
+ }
20
+ let ahead = inputSlots[inputSlots.length - 1];
21
+ for (const test of lookahead) {
22
+ const next = nextVisibleSlot(slots, ahead + 1, skip);
23
+ if (next === void 0 || !test(slots[next].glyphId)) return;
24
+ ahead = next;
25
+ }
26
+ return inputSlots;
27
+ }
28
+ function applyContextualRule(slots, inputSlots, records, lookupOf, skip, depth) {
29
+ const first = inputSlots[0];
30
+ const last = inputSlots[inputSlots.length - 1];
31
+ const window = [];
32
+ for (let s = first; s <= last; s++) window.push({
33
+ glyphId: slots[s].glyphId,
34
+ span: slots[s].span
35
+ });
36
+ for (const record of records) {
37
+ const lookup = lookupOf(record.lookupIndex);
38
+ if (lookup === void 0 || record.sequenceIndex >= inputSlots.length || depth >= 6) return;
39
+ const target = visibleInputSlot(window, record.sequenceIndex, skip);
40
+ if (target !== void 0) {
41
+ const application = applyLookupAtSlot(window, target, lookup, depth + 1);
42
+ if (application !== void 0) window.splice(target, application.consumed, ...application.replacement);
43
+ }
44
+ }
45
+ return {
46
+ consumed: last - first + 1,
47
+ replacement: window
48
+ };
49
+ }
50
+ function visibleInputSlot(window, position, skip) {
51
+ let seen = 0;
52
+ for (let i = 0; i < window.length; i++) {
53
+ if (skip(window[i].glyphId)) continue;
54
+ if (seen === position) return i;
55
+ seen += 1;
56
+ }
57
+ }
58
+ function applyLookupAtSlot(slots, index, lookup, depth) {
59
+ for (const subtable of lookup.subtables) {
60
+ const application = subtable(slots, index, depth);
61
+ if (application !== void 0) return application;
62
+ }
63
+ }
64
+ const SUBST_LOOKUP_RECORD_SIZE = 4;
65
+ function readSubstLookupRecords(bytes, offset, count) {
66
+ if (!hasBytes(bytes, offset, count * SUBST_LOOKUP_RECORD_SIZE)) return;
67
+ const records = [];
68
+ for (let i = 0; i < count; i++) {
69
+ const recordOffset = offset + i * SUBST_LOOKUP_RECORD_SIZE;
70
+ records.push({
71
+ sequenceIndex: u16(bytes, recordOffset),
72
+ lookupIndex: u16(bytes, recordOffset + 2)
73
+ });
74
+ }
75
+ return records;
76
+ }
77
+ function parseFormat3Rule(bytes, subtableOffset, chained) {
78
+ let offset = subtableOffset + 2;
79
+ const backtrack = [];
80
+ const input = [];
81
+ const lookahead = [];
82
+ const readCoverageArray = () => {
83
+ if (!hasBytes(bytes, offset, 2)) return;
84
+ const count = u16(bytes, offset);
85
+ offset += 2;
86
+ if (!hasBytes(bytes, offset, count * 2)) return;
87
+ const coverages = [];
88
+ for (let i = 0; i < count; i++) {
89
+ const coverageOffset = u16(bytes, offset + i * 2);
90
+ if (coverageOffset === 0) return;
91
+ const coverage = parseCoverage(bytes, subtableOffset + coverageOffset);
92
+ if (coverage === void 0) return;
93
+ coverages.push(coverage);
94
+ }
95
+ offset += count * 2;
96
+ return coverages;
97
+ };
98
+ if (chained) {
99
+ const backtracks = readCoverageArray();
100
+ if (backtracks === void 0) return;
101
+ backtrack.push(...backtracks);
102
+ }
103
+ {
104
+ const inputs = readCoverageArray();
105
+ if (inputs === void 0 || inputs.length === 0) return;
106
+ input.push(...inputs);
107
+ }
108
+ if (chained) {
109
+ const lookaheads = readCoverageArray();
110
+ if (lookaheads === void 0) return;
111
+ lookahead.push(...lookaheads);
112
+ }
113
+ if (!hasBytes(bytes, offset, 2)) return;
114
+ const substCount = u16(bytes, offset);
115
+ const records = readSubstLookupRecords(bytes, offset + 2, substCount);
116
+ if (records === void 0) return;
117
+ return {
118
+ backtrack,
119
+ input,
120
+ lookahead,
121
+ records
122
+ };
123
+ }
124
+ function format3Subtable(rule, skip, lookupOf) {
125
+ const inputRest = [];
126
+ for (let i = 1; i < rule.input.length; i++) {
127
+ const coverage = rule.input[i];
128
+ inputRest.push((glyphId) => coverage.coverageIndex(glyphId) !== void 0);
129
+ }
130
+ const backtrack = rule.backtrack.map((coverage) => (glyphId) => coverage.coverageIndex(glyphId) !== void 0);
131
+ const lookahead = rule.lookahead.map((coverage) => (glyphId) => coverage.coverageIndex(glyphId) !== void 0);
132
+ return (slots, index, depth) => {
133
+ const slot = slots[index];
134
+ if (skip(slot.glyphId)) return;
135
+ if (rule.input[0].coverageIndex(slot.glyphId) === void 0) return;
136
+ const inputSlots = matchContextualRule(slots, index, skip, backtrack, inputRest, lookahead);
137
+ if (inputSlots === void 0) return;
138
+ return applyContextualRule(slots, inputSlots, rule.records, lookupOf, skip, depth);
139
+ };
140
+ }
141
+ function readSequenceRule(bytes, ruleOffset, chained) {
142
+ let offset = ruleOffset;
143
+ const readU16 = () => {
144
+ if (!hasBytes(bytes, offset, 2)) return;
145
+ const value = u16(bytes, offset);
146
+ offset += 2;
147
+ return value;
148
+ };
149
+ const readArray = () => {
150
+ const count = readU16();
151
+ if (count === void 0 || !hasBytes(bytes, offset, count * 2)) return;
152
+ const values = [];
153
+ for (let i = 0; i < count; i++) values.push(u16(bytes, offset + i * 2));
154
+ offset += count * 2;
155
+ return values;
156
+ };
157
+ const backtrack = chained ? readArray() : [];
158
+ const glyphCount = readU16();
159
+ if (backtrack === void 0 || glyphCount === void 0 || glyphCount === 0 || !hasBytes(bytes, offset, (glyphCount - 1) * 2)) return;
160
+ const input = [];
161
+ for (let i = 0; i < glyphCount - 1; i++) input.push(u16(bytes, offset + i * 2));
162
+ offset += (glyphCount - 1) * 2;
163
+ const lookahead = chained ? readArray() : [];
164
+ const substCount = readU16();
165
+ if (lookahead === void 0 || substCount === void 0) return;
166
+ const records = readSubstLookupRecords(bytes, offset, substCount);
167
+ if (records === void 0) return;
168
+ return {
169
+ backtrack,
170
+ input,
171
+ lookahead,
172
+ records
173
+ };
174
+ }
175
+ function sequenceSubtable(bytes, subtableOffset, coverage, setCount, setOffsetsOffset, chained, access, skip, lookupOf) {
176
+ const readSet = (entryGlyphId) => {
177
+ const setIndex = access.setIndexOf(entryGlyphId);
178
+ if (setIndex === void 0 || setIndex >= setCount) return [];
179
+ const setOffset = u16(bytes, setOffsetsOffset + setIndex * 2);
180
+ if (setOffset === 0) return [];
181
+ const ruleSetOffset = subtableOffset + setOffset;
182
+ if (!hasBytes(bytes, ruleSetOffset, 2)) return [];
183
+ const ruleCount = u16(bytes, ruleSetOffset);
184
+ if (!hasBytes(bytes, ruleSetOffset + 2, ruleCount * 2)) return [];
185
+ const rules = [];
186
+ for (let i = 0; i < ruleCount; i++) {
187
+ const rule = readSequenceRule(bytes, ruleSetOffset + u16(bytes, ruleSetOffset + 2 + i * 2), chained);
188
+ if (rule !== void 0) rules.push(rule);
189
+ }
190
+ return rules;
191
+ };
192
+ return (slots, index, depth) => {
193
+ const slot = slots[index];
194
+ if (skip(slot.glyphId)) return;
195
+ if (coverage.coverageIndex(slot.glyphId) === void 0) return;
196
+ for (const rule of readSet(slot.glyphId)) {
197
+ const inputSlots = matchContextualRule(slots, index, skip, rule.backtrack.map(access.backtrackTest), rule.input.map(access.inputTest), rule.lookahead.map(access.lookaheadTest));
198
+ if (inputSlots !== void 0) return applyContextualRule(slots, inputSlots, rule.records, lookupOf, skip, depth);
199
+ }
200
+ };
201
+ }
202
+ function parseSubtable(bytes, lookupType, subtableOffset, skip, lookupOf) {
203
+ if (lookupType === 7) {
204
+ if (!hasBytes(bytes, subtableOffset, 8) || u16(bytes, subtableOffset) !== 1) return;
205
+ const extensionLookupType = u16(bytes, subtableOffset + 2);
206
+ if (extensionLookupType === 7) return;
207
+ return parseSubtable(bytes, extensionLookupType, subtableOffset + u32(bytes, subtableOffset + 4), skip, lookupOf);
208
+ }
209
+ if (lookupType === 1) {
210
+ if (!hasBytes(bytes, subtableOffset, 2)) return;
211
+ const substFormat = u16(bytes, subtableOffset);
212
+ if (substFormat === 1) return parseSingleSubstFormat1(bytes, subtableOffset, skip);
213
+ if (substFormat === 2) return parseSingleSubstFormat2(bytes, subtableOffset, skip);
214
+ return;
215
+ }
216
+ if (lookupType === 4) {
217
+ if (!hasBytes(bytes, subtableOffset, 2)) return;
218
+ if (u16(bytes, subtableOffset) !== 1) return;
219
+ return parseLigatureSubstFormat1(bytes, subtableOffset, skip);
220
+ }
221
+ if (lookupType === 5 || lookupType === 6) return parseContextualSubtable(bytes, lookupType === 6, subtableOffset, skip, lookupOf);
222
+ }
223
+ function parseContextualSubtable(bytes, chained, subtableOffset, skip, lookupOf) {
224
+ if (!hasBytes(bytes, subtableOffset, 2)) return;
225
+ const substFormat = u16(bytes, subtableOffset);
226
+ if (substFormat === 3) {
227
+ const rule = parseFormat3Rule(bytes, subtableOffset, chained);
228
+ return rule === void 0 ? void 0 : format3Subtable(rule, skip, lookupOf);
229
+ }
230
+ if (substFormat === 1) {
231
+ const prefixSize = 6;
232
+ if (!hasBytes(bytes, subtableOffset, prefixSize)) return;
233
+ const coverage = parseCoverage(bytes, subtableOffset + u16(bytes, subtableOffset + 2));
234
+ if (coverage === void 0) return;
235
+ const setCount = u16(bytes, subtableOffset + 4);
236
+ const setOffsetsOffset = subtableOffset + prefixSize;
237
+ if (!hasBytes(bytes, setOffsetsOffset, setCount * 2)) return;
238
+ const glyphEquality = (expected) => (glyphId) => glyphId === expected;
239
+ return sequenceSubtable(bytes, subtableOffset, coverage, setCount, setOffsetsOffset, chained, {
240
+ setIndexOf: (entryGlyphId) => coverage.coverageIndex(entryGlyphId),
241
+ backtrackTest: glyphEquality,
242
+ inputTest: glyphEquality,
243
+ lookaheadTest: glyphEquality
244
+ }, skip, lookupOf);
245
+ }
246
+ if (substFormat === 2) {
247
+ const prefixSize = chained ? 12 : 8;
248
+ if (!hasBytes(bytes, subtableOffset, prefixSize)) return;
249
+ const coverage = parseCoverage(bytes, subtableOffset + u16(bytes, subtableOffset + 2));
250
+ if (coverage === void 0) return;
251
+ const inputClassDefOffset = chained ? u16(bytes, subtableOffset + 6) : u16(bytes, subtableOffset + 4);
252
+ const inputClassDef = inputClassDefOffset === 0 ? constantZeroClassDef : parseClassDef(bytes, subtableOffset + inputClassDefOffset);
253
+ const readAuxClassDef = (offset) => offset === 0 ? constantZeroClassDef : parseClassDef(bytes, subtableOffset + offset);
254
+ const backtrackClassDef = chained ? readAuxClassDef(u16(bytes, subtableOffset + 4)) : constantZeroClassDef;
255
+ const lookaheadClassDef = chained ? readAuxClassDef(u16(bytes, subtableOffset + 8)) : constantZeroClassDef;
256
+ if (inputClassDef === void 0 || backtrackClassDef === void 0 || lookaheadClassDef === void 0) return;
257
+ const setCount = u16(bytes, subtableOffset + prefixSize - 2);
258
+ const setOffsetsOffset = subtableOffset + prefixSize;
259
+ if (!hasBytes(bytes, setOffsetsOffset, setCount * 2)) return;
260
+ const classEquality = (classDef, expected) => (glyphId) => classDef(glyphId) === expected;
261
+ return sequenceSubtable(bytes, subtableOffset, coverage, setCount, setOffsetsOffset, chained, {
262
+ setIndexOf: (entryGlyphId) => inputClassDef(entryGlyphId),
263
+ backtrackTest: (expected) => classEquality(backtrackClassDef, expected),
264
+ inputTest: (expected) => classEquality(inputClassDef, expected),
265
+ lookaheadTest: (expected) => classEquality(lookaheadClassDef, expected)
266
+ }, skip, lookupOf);
267
+ }
268
+ }
269
+ //#endregion
270
+ //#region src/gsub-table.ts
271
+ const constantZeroClassDef = () => 0;
272
+ const DEFAULT_GSUB_FEATURE_TAGS = [
273
+ "liga",
274
+ "rlig",
275
+ "calt",
276
+ "clig"
277
+ ];
278
+ const GSUB_OPT_IN_FEATURE_TAGS = ["smcp", "dlig"];
279
+ const GSUB_HEADER_SIZE = 10;
280
+ const GSUB_HEADER_SCRIPT_LIST_OFFSET = 4;
281
+ const GSUB_HEADER_FEATURE_LIST_OFFSET = 6;
282
+ const GSUB_HEADER_LOOKUP_LIST_OFFSET = 8;
283
+ const SCRIPT_RECORD_SIZE = 6;
284
+ const SCRIPT_RECORD_OFFSET_FIELD_OFFSET = 4;
285
+ const FEATURE_RECORD_SIZE = 6;
286
+ const FEATURE_RECORD_OFFSET_FIELD_OFFSET = 4;
287
+ const LANG_SYS_HEADER_SIZE = 6;
288
+ const LANG_SYS_FEATURE_INDEX_COUNT_OFFSET = 4;
289
+ const FEATURE_HEADER_SIZE = 4;
290
+ const LOOKUP_HEADER_SIZE = 6;
291
+ const LOOKUP_HEADER_SUBTABLE_COUNT_OFFSET = 4;
292
+ const LOOKUP_TYPE_SINGLE_SUBST = 1;
293
+ const LOOKUP_TYPE_LIGATURE_SUBST = 4;
294
+ const LOOKUP_TYPE_CONTEXT_SUBST = 5;
295
+ const LOOKUP_TYPE_CHAIN_CONTEXT_SUBST = 6;
296
+ const LOOKUP_TYPE_EXTENSION_SUBST = 7;
297
+ const EXTENSION_SUBST_HEADER_SIZE = 8;
298
+ const EXTENSION_SUBST_OFFSET_FIELD_OFFSET = 4;
299
+ const BITS_PER_BYTE = 8;
300
+ const BYTE_MASK = 255;
301
+ const SUBST_FORMAT_AND_COVERAGE_SIZE = 4;
302
+ const LOOKUP_FLAG_IGNORE_BASE_GLYPHS = 2;
303
+ const LOOKUP_FLAG_IGNORE_LIGATURES = 4;
304
+ const LOOKUP_FLAG_IGNORE_MARKS = 8;
305
+ const LOOKUP_FLAG_USE_MARK_FILTERING_SET = 16;
306
+ const LOOKUP_FLAG_MARK_ATTACHMENT_TYPE = 65280;
307
+ const MAX_LOOKUP_NESTING_DEPTH = 6;
308
+ const PREFERRED_SCRIPT_TAGS = ["latn", "DFLT"];
309
+ function readTag(bytes, offset) {
310
+ return String.fromCharCode(u16(bytes, offset) >> BITS_PER_BYTE, u16(bytes, offset) & BYTE_MASK, u16(bytes, offset + 2) >> BITS_PER_BYTE, u16(bytes, offset + 2) & BYTE_MASK);
311
+ }
312
+ function glyphSkipper(lookupFlag, markFilteringSet, gdef) {
313
+ if (gdef === void 0 || lookupFlag === 0) return () => false;
314
+ const ignoreBase = (lookupFlag & LOOKUP_FLAG_IGNORE_BASE_GLYPHS) !== 0;
315
+ const ignoreLigatures = (lookupFlag & LOOKUP_FLAG_IGNORE_LIGATURES) !== 0;
316
+ const ignoreMarks = (lookupFlag & LOOKUP_FLAG_IGNORE_MARKS) !== 0;
317
+ const markAttachmentType = (lookupFlag & LOOKUP_FLAG_MARK_ATTACHMENT_TYPE) >> BITS_PER_BYTE;
318
+ const useMarkFilteringSet = (lookupFlag & LOOKUP_FLAG_USE_MARK_FILTERING_SET) !== 0;
319
+ return (glyphId) => {
320
+ const glyphClass = gdef.glyphClass(glyphId);
321
+ if (ignoreBase && glyphClass === 1) return true;
322
+ if (ignoreLigatures && glyphClass === 2) return true;
323
+ if (glyphClass !== 3) return false;
324
+ if (ignoreMarks) return true;
325
+ if (markAttachmentType !== 0 && gdef.markAttachClass(glyphId) !== markAttachmentType) return true;
326
+ return useMarkFilteringSet && !gdef.markFilteringSetCovers(markFilteringSet, glyphId);
327
+ };
328
+ }
329
+ function nextVisibleSlot(slots, from, skip) {
330
+ for (let i = Math.max(from, 0); i < slots.length; i++) if (!skip(slots[i].glyphId)) return i;
331
+ }
332
+ function prevVisibleSlot(slots, before, skip) {
333
+ for (let i = Math.min(before, slots.length) - 1; i >= 0; i--) if (!skip(slots[i].glyphId)) return i;
334
+ }
335
+ const SINGLE_SUBST_FORMAT_1_SIZE = 6;
336
+ function parseSingleSubstFormat1(bytes, subtableOffset, skip) {
337
+ if (!hasBytes(bytes, subtableOffset, SINGLE_SUBST_FORMAT_1_SIZE)) return;
338
+ const coverage = parseCoverage(bytes, subtableOffset + u16(bytes, subtableOffset + 2));
339
+ if (coverage === void 0) return;
340
+ const delta = i16(bytes, subtableOffset + 4);
341
+ return (slots, index) => {
342
+ const slot = slots[index];
343
+ if (skip(slot.glyphId)) return;
344
+ if (coverage.coverageIndex(slot.glyphId) === void 0) return;
345
+ return {
346
+ consumed: 1,
347
+ replacement: [{
348
+ glyphId: slot.glyphId + delta,
349
+ span: slot.span
350
+ }]
351
+ };
352
+ };
353
+ }
354
+ const SINGLE_SUBST_FORMAT_2_HEADER_SIZE = 6;
355
+ function parseSingleSubstFormat2(bytes, subtableOffset, skip) {
356
+ if (!hasBytes(bytes, subtableOffset, SINGLE_SUBST_FORMAT_2_HEADER_SIZE)) return;
357
+ const coverage = parseCoverage(bytes, subtableOffset + u16(bytes, subtableOffset + 2));
358
+ if (coverage === void 0) return;
359
+ const glyphCount = u16(bytes, subtableOffset + 4);
360
+ const substitutesOffset = subtableOffset + SINGLE_SUBST_FORMAT_2_HEADER_SIZE;
361
+ if (!hasBytes(bytes, substitutesOffset, glyphCount * 2)) return;
362
+ return (slots, index) => {
363
+ const slot = slots[index];
364
+ if (skip(slot.glyphId)) return;
365
+ const coverageIndex = coverage.coverageIndex(slot.glyphId);
366
+ if (coverageIndex === void 0 || coverageIndex >= glyphCount) return;
367
+ return {
368
+ consumed: 1,
369
+ replacement: [{
370
+ glyphId: u16(bytes, substitutesOffset + coverageIndex * 2),
371
+ span: slot.span
372
+ }]
373
+ };
374
+ };
375
+ }
376
+ const LIGATURE_SUBST_FORMAT_1_HEADER_SIZE = 6;
377
+ const LIGATURE_SET_HEADER_SIZE = 2;
378
+ const LIGATURE_HEADER_PREFIX_SIZE = 4;
379
+ function parseLigatureSubstFormat1(bytes, subtableOffset, skip) {
380
+ if (!hasBytes(bytes, subtableOffset, LIGATURE_SUBST_FORMAT_1_HEADER_SIZE)) return;
381
+ const coverage = parseCoverage(bytes, subtableOffset + u16(bytes, subtableOffset + 2));
382
+ if (coverage === void 0) return;
383
+ const ligSetCount = u16(bytes, subtableOffset + 4);
384
+ const ligSetOffsetsOffset = subtableOffset + LIGATURE_SUBST_FORMAT_1_HEADER_SIZE;
385
+ if (!hasBytes(bytes, ligSetOffsetsOffset, ligSetCount * 2)) return;
386
+ return (slots, index) => {
387
+ const first = slots[index];
388
+ if (skip(first.glyphId)) return;
389
+ const coverageIndex = coverage.coverageIndex(first.glyphId);
390
+ if (coverageIndex === void 0 || coverageIndex >= ligSetCount) return;
391
+ const ligSetOffset = subtableOffset + u16(bytes, ligSetOffsetsOffset + coverageIndex * 2);
392
+ if (!hasBytes(bytes, ligSetOffset, LIGATURE_SET_HEADER_SIZE)) return;
393
+ const ligatureCount = u16(bytes, ligSetOffset);
394
+ const ligatureOffsetsOffset = ligSetOffset + LIGATURE_SET_HEADER_SIZE;
395
+ if (!hasBytes(bytes, ligatureOffsetsOffset, ligatureCount * 2)) return;
396
+ for (let i = 0; i < ligatureCount; i++) {
397
+ const ligatureOffset = ligSetOffset + u16(bytes, ligatureOffsetsOffset + i * 2);
398
+ if (!hasBytes(bytes, ligatureOffset, LIGATURE_HEADER_PREFIX_SIZE)) continue;
399
+ const ligatureGlyph = u16(bytes, ligatureOffset);
400
+ const componentCount = u16(bytes, ligatureOffset + 2);
401
+ if (componentCount === 0) continue;
402
+ const componentsOffset = ligatureOffset + LIGATURE_HEADER_PREFIX_SIZE;
403
+ if (!hasBytes(bytes, componentsOffset, (componentCount - 1) * 2)) continue;
404
+ const matchedSlots = [index];
405
+ let cursor = index;
406
+ let matches = true;
407
+ for (let c = 1; c < componentCount; c++) {
408
+ const next = nextVisibleSlot(slots, cursor + 1, skip);
409
+ if (next === void 0 || slots[next].glyphId !== u16(bytes, componentsOffset + (c - 1) * 2)) {
410
+ matches = false;
411
+ break;
412
+ }
413
+ matchedSlots.push(next);
414
+ cursor = next;
415
+ }
416
+ if (!matches) continue;
417
+ const lastSlot = matchedSlots[matchedSlots.length - 1];
418
+ let windowSpan = 0;
419
+ const retained = [];
420
+ for (let s = index; s <= lastSlot; s++) {
421
+ windowSpan += slots[s].span;
422
+ if (skip(slots[s].glyphId)) retained.push({
423
+ glyphId: slots[s].glyphId,
424
+ span: 0
425
+ });
426
+ }
427
+ return {
428
+ consumed: lastSlot - index + 1,
429
+ replacement: [{
430
+ glyphId: ligatureGlyph,
431
+ span: windowSpan
432
+ }, ...retained]
433
+ };
434
+ }
435
+ };
436
+ }
437
+ function findScriptOffset(bytes, scriptListOffset) {
438
+ if (!hasBytes(bytes, scriptListOffset, 2)) return;
439
+ const scriptCount = u16(bytes, scriptListOffset);
440
+ const recordsOffset = scriptListOffset + 2;
441
+ if (!hasBytes(bytes, recordsOffset, scriptCount * SCRIPT_RECORD_SIZE) || scriptCount === 0) return;
442
+ for (const wanted of PREFERRED_SCRIPT_TAGS) for (let i = 0; i < scriptCount; i++) {
443
+ const recordOffset = recordsOffset + i * SCRIPT_RECORD_SIZE;
444
+ if (readTag(bytes, recordOffset) === wanted) return scriptListOffset + u16(bytes, recordOffset + SCRIPT_RECORD_OFFSET_FIELD_OFFSET);
445
+ }
446
+ return scriptListOffset + u16(bytes, recordsOffset + SCRIPT_RECORD_OFFSET_FIELD_OFFSET);
447
+ }
448
+ function parseDefaultLangSysFeatureIndices(bytes, scriptOffset) {
449
+ if (!hasBytes(bytes, scriptOffset, 2)) return [];
450
+ const defaultLangSysOffset = u16(bytes, scriptOffset);
451
+ if (defaultLangSysOffset === 0) return [];
452
+ const langSysOffset = scriptOffset + defaultLangSysOffset;
453
+ if (!hasBytes(bytes, langSysOffset, LANG_SYS_HEADER_SIZE)) return [];
454
+ const featureIndexCount = u16(bytes, langSysOffset + LANG_SYS_FEATURE_INDEX_COUNT_OFFSET);
455
+ const indicesOffset = langSysOffset + LANG_SYS_HEADER_SIZE;
456
+ if (!hasBytes(bytes, indicesOffset, featureIndexCount * 2)) return [];
457
+ const indices = [];
458
+ for (let i = 0; i < featureIndexCount; i++) indices.push(u16(bytes, indicesOffset + i * 2));
459
+ return indices;
460
+ }
461
+ function collectLookupIndices(bytes, featureListOffset, featureIndices, featureTags) {
462
+ if (!hasBytes(bytes, featureListOffset, 2)) return [];
463
+ const featureCount = u16(bytes, featureListOffset);
464
+ const recordsOffset = featureListOffset + 2;
465
+ if (!hasBytes(bytes, recordsOffset, featureCount * FEATURE_RECORD_SIZE)) return [];
466
+ const lookupIndices = [];
467
+ const seen = /* @__PURE__ */ new Set();
468
+ for (const featureIndex of featureIndices) {
469
+ if (featureIndex >= featureCount) continue;
470
+ const recordOffset = recordsOffset + featureIndex * FEATURE_RECORD_SIZE;
471
+ if (!featureTags.includes(readTag(bytes, recordOffset))) continue;
472
+ const featureOffset = featureListOffset + u16(bytes, recordOffset + FEATURE_RECORD_OFFSET_FIELD_OFFSET);
473
+ if (!hasBytes(bytes, featureOffset, FEATURE_HEADER_SIZE)) continue;
474
+ const lookupIndexCount = u16(bytes, featureOffset + 2);
475
+ const indicesOffset = featureOffset + FEATURE_HEADER_SIZE;
476
+ if (!hasBytes(bytes, indicesOffset, lookupIndexCount * 2)) continue;
477
+ for (let i = 0; i < lookupIndexCount; i++) {
478
+ const lookupIndex = u16(bytes, indicesOffset + i * 2);
479
+ if (!seen.has(lookupIndex)) {
480
+ seen.add(lookupIndex);
481
+ lookupIndices.push(lookupIndex);
482
+ }
483
+ }
484
+ }
485
+ return lookupIndices;
486
+ }
487
+ function buildGsubShaper(font, options = {}) {
488
+ const bytes = sfntTableBytes(font, "GSUB");
489
+ if (bytes === void 0 || !hasBytes(bytes, 0, GSUB_HEADER_SIZE) || u16(bytes, 0) !== 1) return;
490
+ const scriptOffset = findScriptOffset(bytes, u16(bytes, GSUB_HEADER_SCRIPT_LIST_OFFSET));
491
+ if (scriptOffset === void 0) return;
492
+ const featureTags = [...DEFAULT_GSUB_FEATURE_TAGS, ...options.optInFeatures ?? []];
493
+ const lookupIndices = collectLookupIndices(bytes, u16(bytes, GSUB_HEADER_FEATURE_LIST_OFFSET), parseDefaultLangSysFeatureIndices(bytes, scriptOffset), featureTags);
494
+ if (lookupIndices.length === 0) return;
495
+ const lookupListOffset = u16(bytes, GSUB_HEADER_LOOKUP_LIST_OFFSET);
496
+ if (!hasBytes(bytes, lookupListOffset, 2)) return;
497
+ const lookupCount = u16(bytes, lookupListOffset);
498
+ const lookupOffsetsOffset = lookupListOffset + 2;
499
+ if (!hasBytes(bytes, lookupOffsetsOffset, lookupCount * 2)) return;
500
+ const gdef = parseGdefTable(font);
501
+ const lookups = [];
502
+ const lookupOf = (lookupIndex) => lookups[lookupIndex];
503
+ for (let i = 0; i < lookupCount; i++) {
504
+ const lookupOffset = lookupListOffset + u16(bytes, lookupOffsetsOffset + i * 2);
505
+ if (!hasBytes(bytes, lookupOffset, LOOKUP_HEADER_SIZE)) {
506
+ lookups.push(void 0);
507
+ continue;
508
+ }
509
+ const lookupFlag = u16(bytes, lookupOffset + 2);
510
+ const lookupType = u16(bytes, lookupOffset);
511
+ const subTableCount = u16(bytes, lookupOffset + LOOKUP_HEADER_SUBTABLE_COUNT_OFFSET);
512
+ const subtableOffsetsOffset = lookupOffset + LOOKUP_HEADER_SIZE;
513
+ const markFilteringSetWidth = (lookupFlag & LOOKUP_FLAG_USE_MARK_FILTERING_SET) !== 0 ? 2 : 0;
514
+ if (!hasBytes(bytes, subtableOffsetsOffset, subTableCount * 2 + markFilteringSetWidth)) {
515
+ lookups.push(void 0);
516
+ continue;
517
+ }
518
+ const skip = glyphSkipper(lookupFlag, markFilteringSetWidth === 0 ? 0 : u16(bytes, subtableOffsetsOffset + subTableCount * 2), gdef);
519
+ const subtables = [];
520
+ for (let s = 0; s < subTableCount; s++) {
521
+ const subtable = parseSubtable(bytes, lookupType, lookupOffset + u16(bytes, subtableOffsetsOffset + s * 2), skip, lookupOf);
522
+ if (subtable !== void 0) subtables.push(subtable);
523
+ }
524
+ lookups.push({ subtables });
525
+ }
526
+ const appliedLookups = [];
527
+ for (const lookupIndex of lookupIndices) {
528
+ const lookup = lookupOf(lookupIndex);
529
+ if (lookup !== void 0) appliedLookups.push(lookup);
530
+ }
531
+ if (appliedLookups.every((lookup) => lookup.subtables.length === 0)) return;
532
+ return (glyphIds) => {
533
+ const slots = glyphIds.map((glyphId) => ({
534
+ glyphId,
535
+ span: 1
536
+ }));
537
+ for (const lookup of appliedLookups) {
538
+ let slotIndex = 0;
539
+ while (slotIndex < slots.length) {
540
+ const application = applyLookupAtSlot(slots, slotIndex, lookup, 0);
541
+ if (application === void 0) {
542
+ slotIndex += 1;
543
+ continue;
544
+ }
545
+ slots.splice(slotIndex, application.consumed, ...application.replacement);
546
+ slotIndex += application.replacement.length !== 0 ? application.replacement.length : 1;
547
+ }
548
+ }
549
+ return {
550
+ glyphIds: slots.map((slot) => slot.glyphId),
551
+ spans: slots.map((slot) => slot.span)
552
+ };
553
+ };
554
+ }
555
+ //#endregion
556
+ export { sequenceSubtable as A, format3Subtable as C, parseSubtable as D, parseFormat3Rule as E, readSequenceRule as O, applyLookupAtSlot as S, parseContextualSubtable as T, parseSingleSubstFormat1 as _, LOOKUP_TYPE_CHAIN_CONTEXT_SUBST as a, readTag as b, LOOKUP_TYPE_LIGATURE_SUBST as c, SUBST_FORMAT_AND_COVERAGE_SIZE as d, buildGsubShaper as f, parseLigatureSubstFormat1 as g, nextVisibleSlot as h, GSUB_OPT_IN_FEATURE_TAGS as i, visibleInputSlot as j, readSubstLookupRecords as k, LOOKUP_TYPE_SINGLE_SUBST as l, glyphSkipper as m, EXTENSION_SUBST_HEADER_SIZE as n, LOOKUP_TYPE_CONTEXT_SUBST as o, constantZeroClassDef as p, EXTENSION_SUBST_OFFSET_FIELD_OFFSET as r, LOOKUP_TYPE_EXTENSION_SUBST as s, DEFAULT_GSUB_FEATURE_TAGS as t, MAX_LOOKUP_NESTING_DEPTH as u, parseSingleSubstFormat2 as v, matchContextualRule as w, applyContextualRule as x, prevVisibleSlot as y };
@@ -0,0 +1,52 @@
1
+ import { t as SfntFont } from "./sfnt-V08bb5ut.cjs";
2
+ import { o as GdefTable } from "./gdef-table-D0Hzn4KD.cjs";
3
+ import { t as ClassDefTable } from "./ot-layout-common-BcsGRFBS.cjs";
4
+ //#region src/gsub-table.d.ts
5
+ declare const constantZeroClassDef: ClassDefTable;
6
+ declare const DEFAULT_GSUB_FEATURE_TAGS: readonly ["liga", "rlig", "calt", "clig"];
7
+ declare const GSUB_OPT_IN_FEATURE_TAGS: readonly ["smcp", "dlig"];
8
+ type GsubOptInFeatureTag = (typeof GSUB_OPT_IN_FEATURE_TAGS)[number];
9
+ interface GsubShaperOptions {
10
+ readonly optInFeatures?: readonly GsubOptInFeatureTag[];
11
+ }
12
+ declare const LOOKUP_TYPE_SINGLE_SUBST = 1;
13
+ declare const LOOKUP_TYPE_LIGATURE_SUBST = 4;
14
+ declare const LOOKUP_TYPE_CONTEXT_SUBST = 5;
15
+ declare const LOOKUP_TYPE_CHAIN_CONTEXT_SUBST = 6;
16
+ declare const LOOKUP_TYPE_EXTENSION_SUBST = 7;
17
+ declare const EXTENSION_SUBST_HEADER_SIZE = 8;
18
+ declare const EXTENSION_SUBST_OFFSET_FIELD_OFFSET = 4;
19
+ declare const SUBST_FORMAT_AND_COVERAGE_SIZE = 4;
20
+ declare const MAX_LOOKUP_NESTING_DEPTH = 6;
21
+ declare function readTag(bytes: Uint8Array<ArrayBuffer>, offset: number): string;
22
+ interface GsubShaping {
23
+ readonly glyphIds: number[];
24
+ readonly spans: number[];
25
+ }
26
+ type GsubShaper = (glyphIds: readonly number[]) => GsubShaping;
27
+ interface ShapingSlot {
28
+ glyphId: number;
29
+ span: number;
30
+ }
31
+ interface SlotApplication {
32
+ readonly consumed: number;
33
+ readonly replacement: readonly ShapingSlot[];
34
+ }
35
+ interface SubstLookupRecord {
36
+ readonly sequenceIndex: number;
37
+ readonly lookupIndex: number;
38
+ }
39
+ type GsubSubtable = (slots: readonly ShapingSlot[], index: number, depth: number) => SlotApplication | undefined;
40
+ interface GsubLookup {
41
+ readonly subtables: readonly GsubSubtable[];
42
+ }
43
+ declare function glyphSkipper(lookupFlag: number, markFilteringSet: number, gdef: GdefTable | undefined): (glyphId: number) => boolean;
44
+ declare function nextVisibleSlot(slots: readonly ShapingSlot[], from: number, skip: (glyphId: number) => boolean): number | undefined;
45
+ declare function prevVisibleSlot(slots: readonly ShapingSlot[], before: number, skip: (glyphId: number) => boolean): number | undefined;
46
+ declare function parseSingleSubstFormat1(bytes: Uint8Array<ArrayBuffer>, subtableOffset: number, skip: (glyphId: number) => boolean): GsubSubtable | undefined;
47
+ declare function parseSingleSubstFormat2(bytes: Uint8Array<ArrayBuffer>, subtableOffset: number, skip: (glyphId: number) => boolean): GsubSubtable | undefined;
48
+ declare function parseLigatureSubstFormat1(bytes: Uint8Array<ArrayBuffer>, subtableOffset: number, skip: (glyphId: number) => boolean): GsubSubtable | undefined;
49
+ type ContextualGlyphTest = (glyphId: number) => boolean;
50
+ declare function buildGsubShaper(font: SfntFont, options?: GsubShaperOptions): GsubShaper | undefined;
51
+ //#endregion
52
+ export { readTag as A, constantZeroClassDef as C, parseSingleSubstFormat1 as D, parseLigatureSubstFormat1 as E, parseSingleSubstFormat2 as O, buildGsubShaper as S, nextVisibleSlot as T, MAX_LOOKUP_NESTING_DEPTH as _, GSUB_OPT_IN_FEATURE_TAGS as a, SlotApplication as b, GsubShaper as c, GsubSubtable as d, LOOKUP_TYPE_CHAIN_CONTEXT_SUBST as f, LOOKUP_TYPE_SINGLE_SUBST as g, LOOKUP_TYPE_LIGATURE_SUBST as h, EXTENSION_SUBST_OFFSET_FIELD_OFFSET as i, prevVisibleSlot as k, GsubShaperOptions as l, LOOKUP_TYPE_EXTENSION_SUBST as m, DEFAULT_GSUB_FEATURE_TAGS as n, GsubLookup as o, LOOKUP_TYPE_CONTEXT_SUBST as p, EXTENSION_SUBST_HEADER_SIZE as r, GsubOptInFeatureTag as s, ContextualGlyphTest as t, GsubShaping as u, SUBST_FORMAT_AND_COVERAGE_SIZE as v, glyphSkipper as w, SubstLookupRecord as x, ShapingSlot as y };