@cantoo/fontkit 2.0.5 → 2.0.7
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/dist/browser-module.d.ts +239 -0
- package/dist/browser-module.mjs +4423 -1117
- package/dist/browser-module.mjs.map +1 -1
- package/dist/browser.cjs +4424 -1117
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +239 -0
- package/dist/fontkit.umd.d.ts +239 -0
- package/dist/fontkit.umd.js +22076 -0
- package/dist/fontkit.umd.js.map +7 -0
- package/dist/index.d.ts +239 -0
- package/dist/main.cjs +4424 -1117
- package/dist/main.cjs.map +1 -1
- package/dist/main.d.ts +239 -0
- package/dist/module.d.ts +239 -0
- package/dist/module.mjs +4423 -1117
- package/dist/module.mjs.map +1 -1
- package/package.json +22 -5
- package/src/CmapProcessor.js +59 -20
- package/src/DFont.js +114 -14
- package/src/TTFFont.js +259 -57
- package/src/TrueTypeCollection.js +54 -10
- package/src/WOFF2Font.js +128 -16
- package/src/WOFFFont.js +45 -8
- package/src/aat/AATFeatureMap.js +62 -18
- package/src/aat/AATLayoutEngine.js +33 -1
- package/src/aat/AATLookupTable.js +22 -4
- package/src/aat/AATMorxProcessor.js +189 -52
- package/src/aat/AATStateMachine.js +32 -0
- package/src/base.js +19 -0
- package/src/cff/CFFCharsets.js +3 -0
- package/src/cff/CFFDict.js +79 -9
- package/src/cff/CFFEncodings.js +2 -0
- package/src/cff/CFFFont.js +119 -23
- package/src/cff/CFFIndex.js +62 -5
- package/src/cff/CFFOperand.js +52 -17
- package/src/cff/CFFPointer.js +41 -2
- package/src/cff/CFFPrivateDict.js +14 -4
- package/src/cff/CFFStandardStrings.js +1 -0
- package/src/cff/CFFTop.js +103 -10
- package/src/decorators.js +32 -13
- package/src/encodings.js +22 -5
- package/src/fs.js +10 -0
- package/src/glyph/BBox.js +14 -0
- package/src/glyph/CFFGlyph.js +290 -148
- package/src/glyph/COLRGlyph.js +38 -3
- package/src/glyph/Glyph.js +68 -9
- package/src/glyph/GlyphVariationProcessor.js +135 -34
- package/src/glyph/Path.js +107 -20
- package/src/glyph/SBIXGlyph.js +57 -8
- package/src/glyph/StandardNames.js +1 -0
- package/src/glyph/TTFGlyph.js +176 -29
- package/src/glyph/TTFGlyphEncoder.js +32 -0
- package/src/glyph/WOFF2Glyph.js +23 -4
- package/src/layout/GlyphPosition.js +6 -0
- package/src/layout/GlyphRun.js +25 -7
- package/src/layout/KernProcessor.js +62 -3
- package/src/layout/LayoutEngine.js +86 -12
- package/src/layout/Script.js +27 -1
- package/src/layout/UnicodeLayoutEngine.js +29 -4
- package/src/opentype/GPOSProcessor.js +156 -45
- package/src/opentype/GSUBProcessor.js +92 -33
- package/src/opentype/GlyphInfo.js +52 -4
- package/src/opentype/GlyphIterator.js +51 -2
- package/src/opentype/OTLayoutEngine.js +66 -8
- package/src/opentype/OTProcessor.js +283 -70
- package/src/opentype/ShapingPlan.js +51 -3
- package/src/opentype/shapers/ArabicShaper.js +19 -0
- package/src/opentype/shapers/DefaultShaper.js +51 -7
- package/src/opentype/shapers/HangulShaper.js +85 -7
- package/src/opentype/shapers/HebrewShaper.js +45 -11
- package/src/opentype/shapers/IndicShaper.js +141 -26
- package/src/opentype/shapers/ThaiShaper.js +35 -4
- package/src/opentype/shapers/UniversalShaper.js +83 -17
- package/src/opentype/shapers/index.js +15 -2
- package/src/packages/unicode-properties/data-trie.js +1 -0
- package/src/packages/unicode-properties/data.js +12 -0
- package/src/packages/unicode-properties/dist/index.cjs +22 -9
- package/src/packages/unicode-properties/dist/index.cjs.map +2 -2
- package/src/packages/unicode-properties/dist/index.mjs +21 -9
- package/src/packages/unicode-properties/dist/index.mjs.map +2 -2
- package/src/packages/unicode-properties/index.js +65 -0
- package/src/packages/unicode-properties/package.json +1 -1
- package/src/packages/unicode-trie/builder.js +128 -7
- package/src/packages/unicode-trie/dist/builder.cjs +129 -16
- package/src/packages/unicode-trie/dist/builder.cjs.map +2 -2
- package/src/packages/unicode-trie/dist/builder.mjs +128 -16
- package/src/packages/unicode-trie/dist/builder.mjs.map +2 -2
- package/src/packages/unicode-trie/dist/index.cjs +22 -9
- package/src/packages/unicode-trie/dist/index.cjs.map +2 -2
- package/src/packages/unicode-trie/dist/index.mjs +21 -9
- package/src/packages/unicode-trie/dist/index.mjs.map +2 -2
- package/src/packages/unicode-trie/index.js +62 -10
- package/src/packages/unicode-trie/package.json +1 -1
- package/src/packages/unicode-trie/swap.js +13 -0
- package/src/subset/CFFSubset.js +112 -22
- package/src/subset/Subset.js +21 -1
- package/src/subset/TTFSubset.js +79 -36
- package/src/tables/BASE.js +1 -0
- package/src/tables/COLR.js +1 -0
- package/src/tables/CPAL.js +1 -0
- package/src/tables/DSIG.js +1 -0
- package/src/tables/EBDT.js +10 -3
- package/src/tables/EBLC.js +67 -7
- package/src/tables/GDEF.js +1 -0
- package/src/tables/GPOS.js +79 -16
- package/src/tables/GSUB.js +14 -3
- package/src/tables/HVAR.js +51 -5
- package/src/tables/JSTF.js +3 -2
- package/src/tables/LTSH.js +1 -0
- package/src/tables/OS2.js +1 -0
- package/src/tables/PCLT.js +1 -0
- package/src/tables/STAT.js +46 -6
- package/src/tables/VDMX.js +1 -0
- package/src/tables/VORG.js +1 -0
- package/src/tables/WOFF2Directory.js +56 -8
- package/src/tables/WOFFDirectory.js +14 -2
- package/src/tables/aat.js +160 -35
- package/src/tables/avar.js +1 -0
- package/src/tables/bsln.js +3 -2
- package/src/tables/cmap.js +26 -6
- package/src/tables/cvt.js +1 -0
- package/src/tables/directory.js +44 -16
- package/src/tables/feat.js +24 -2
- package/src/tables/fpgm.js +1 -0
- package/src/tables/fvar.js +32 -4
- package/src/tables/gasp.js +1 -0
- package/src/tables/glyf.js +1 -0
- package/src/tables/gvar.js +29 -2
- package/src/tables/hdmx.js +12 -1
- package/src/tables/head.js +1 -0
- package/src/tables/hhea.js +1 -0
- package/src/tables/hmtx.js +18 -2
- package/src/tables/index.js +1 -0
- package/src/tables/just.js +15 -4
- package/src/tables/kern.js +43 -6
- package/src/tables/loca.js +21 -8
- package/src/tables/maxp.js +1 -0
- package/src/tables/morx.js +14 -7
- package/src/tables/name.js +104 -23
- package/src/tables/opbd.js +2 -1
- package/src/tables/opentype.js +39 -4
- package/src/tables/post.js +8 -1
- package/src/tables/prep.js +1 -0
- package/src/tables/sbix.js +12 -1
- package/src/tables/variations.js +23 -3
- package/src/tables/vhea.js +1 -0
- package/src/tables/vmtx.js +18 -2
- package/src/utils.js +15 -0
- package/types/assets.d.ts +13 -0
- package/types/deps.d.ts +83 -0
- package/types/fontkit.d.ts +1324 -0
- package/types/index.d.ts +239 -0
- package/types/restructure.d.ts +354 -0
|
@@ -0,0 +1,1324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared domain types for fontkit.
|
|
3
|
+
* Referenced from JSDoc via `import('...').Name` or global aliases below.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
DecodeStream,
|
|
8
|
+
EncodeStream,
|
|
9
|
+
StructValue,
|
|
10
|
+
BinaryBuffer,
|
|
11
|
+
BaseType
|
|
12
|
+
} from 'restructure';
|
|
13
|
+
|
|
14
|
+
export type { DecodeStream, EncodeStream, StructValue, BinaryBuffer, BaseType };
|
|
15
|
+
|
|
16
|
+
/** OpenType script tag (4-char string, may include trailing spaces). */
|
|
17
|
+
export type ScriptTag = string;
|
|
18
|
+
|
|
19
|
+
/** OpenType language tag. */
|
|
20
|
+
export type LanguageTag = string;
|
|
21
|
+
|
|
22
|
+
/** Text direction used by the layout engine. */
|
|
23
|
+
export type TextDirection = 'ltr' | 'rtl';
|
|
24
|
+
|
|
25
|
+
/** Feature value: boolean enable, or 1-based alternate index (e.g. aalt). */
|
|
26
|
+
export type FeatureValue = boolean | number;
|
|
27
|
+
|
|
28
|
+
/** Feature map: feature tag → enabled or alternate index. */
|
|
29
|
+
export type FeatureMap = Record<string, FeatureValue>;
|
|
30
|
+
|
|
31
|
+
/** Features may be passed as tags or as an enable/value map. */
|
|
32
|
+
export type FeatureInput = string[] | FeatureMap;
|
|
33
|
+
|
|
34
|
+
/** Variation axis coordinates keyed by axis tag. */
|
|
35
|
+
export type VariationCoords = Record<string, number> | number[] | null;
|
|
36
|
+
|
|
37
|
+
/** Directory entry for an SFNT table (includes WOFF/WOFF2 fields). */
|
|
38
|
+
export interface TableEntry {
|
|
39
|
+
tag: string;
|
|
40
|
+
checksum?: number;
|
|
41
|
+
checkSum?: number;
|
|
42
|
+
offset: number;
|
|
43
|
+
length: number;
|
|
44
|
+
/** WOFF compressed length. */
|
|
45
|
+
compLength?: number;
|
|
46
|
+
/** WOFF2 transform metadata. */
|
|
47
|
+
transformLength?: number;
|
|
48
|
+
transformed?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Decoded SFNT / WOFF / WOFF2 directory. */
|
|
52
|
+
export interface FontDirectory {
|
|
53
|
+
tag?: string;
|
|
54
|
+
numTables?: number;
|
|
55
|
+
tables: Record<string, TableEntry>;
|
|
56
|
+
/** WOFF2 total compressed payload size. */
|
|
57
|
+
totalCompressedSize?: number;
|
|
58
|
+
flavor?: number;
|
|
59
|
+
length?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Glyph metrics bundle returned by Glyph._getMetrics. */
|
|
63
|
+
export interface GlyphMetrics {
|
|
64
|
+
width: number;
|
|
65
|
+
height: number;
|
|
66
|
+
advanceWidth: number;
|
|
67
|
+
advanceHeight: number;
|
|
68
|
+
leftBearing: number;
|
|
69
|
+
topBearing: number;
|
|
70
|
+
rightBearing: number;
|
|
71
|
+
bottomBearing: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Font-level metrics from hhea/OS/2. */
|
|
75
|
+
export interface FontMetrics {
|
|
76
|
+
ascent: number;
|
|
77
|
+
descent: number;
|
|
78
|
+
lineGap: number;
|
|
79
|
+
lineHeight: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Path drawing command. */
|
|
83
|
+
export interface PathCommand {
|
|
84
|
+
command: 'moveTo' | 'lineTo' | 'quadraticCurveTo' | 'bezierCurveTo' | 'closePath';
|
|
85
|
+
args: number[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Minimal canvas-like context used by Glyph.render / Path.toFunction. */
|
|
89
|
+
export interface PathRenderingContext {
|
|
90
|
+
save(): void;
|
|
91
|
+
restore(): void;
|
|
92
|
+
scale(x: number, y: number): void;
|
|
93
|
+
fill(): void;
|
|
94
|
+
moveTo?(x: number, y: number): void;
|
|
95
|
+
lineTo?(x: number, y: number): void;
|
|
96
|
+
quadraticCurveTo?(cpx: number, cpy: number, x: number, y: number): void;
|
|
97
|
+
bezierCurveTo?(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
98
|
+
closePath?(): void;
|
|
99
|
+
/** PDFKit-style fill used by COLR glyphs. */
|
|
100
|
+
fillColor?(rgb: [number, number, number] | number[], alphaPercent?: number): void;
|
|
101
|
+
/** PDFKit-style image draw used by SBIX glyphs. */
|
|
102
|
+
image?(data: BinaryBuffer | unknown, options?: { height?: number; x?: number; y?: number }): void;
|
|
103
|
+
[key: string]: unknown;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Single horizontal/vertical metric entry from hmtx/vmtx. */
|
|
107
|
+
export interface HmtxMetric {
|
|
108
|
+
advance: number;
|
|
109
|
+
bearing: number;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Lazy array surface used by hmtx/vmtx. */
|
|
113
|
+
export interface LazyMetricArray<T> {
|
|
114
|
+
length: number;
|
|
115
|
+
get(index: number): T | undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Decoded hmtx or vmtx table. */
|
|
119
|
+
export interface MetricsTable {
|
|
120
|
+
metrics: LazyMetricArray<HmtxMetric>;
|
|
121
|
+
bearings: LazyMetricArray<number>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** head table fields used by glyphs and font metrics. */
|
|
125
|
+
export interface HeadTable {
|
|
126
|
+
unitsPerEm: number;
|
|
127
|
+
xMin: number;
|
|
128
|
+
yMin: number;
|
|
129
|
+
xMax: number;
|
|
130
|
+
yMax: number;
|
|
131
|
+
indexToLocFormat?: number;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Horizontal header table. */
|
|
135
|
+
export interface HheaTable {
|
|
136
|
+
ascent: number;
|
|
137
|
+
descent: number;
|
|
138
|
+
lineGap: number;
|
|
139
|
+
numberOfMetrics: number;
|
|
140
|
+
advanceWidthMax?: number;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Maximum profile table. */
|
|
144
|
+
export interface MaxpTable {
|
|
145
|
+
numGlyphs: number;
|
|
146
|
+
version?: number;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** OS/2 selection flags used for metrics. */
|
|
150
|
+
export interface OS2FsSelection {
|
|
151
|
+
useTypoMetrics?: boolean;
|
|
152
|
+
italic?: boolean;
|
|
153
|
+
bold?: boolean;
|
|
154
|
+
[flag: string]: boolean | undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** OS/2 table (fields vary by version). */
|
|
158
|
+
export interface OS2Table {
|
|
159
|
+
version: number;
|
|
160
|
+
fsSelection: OS2FsSelection;
|
|
161
|
+
typoAscender?: number;
|
|
162
|
+
typoDescender?: number;
|
|
163
|
+
typoLineGap?: number;
|
|
164
|
+
winAscent?: number;
|
|
165
|
+
winDescent?: number;
|
|
166
|
+
capHeight?: number;
|
|
167
|
+
xHeight?: number;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Localized name strings keyed by BCP-47 / platform language id. */
|
|
171
|
+
export type NameLocaleMap = Record<string, string | BinaryBuffer | undefined>;
|
|
172
|
+
|
|
173
|
+
/** Decoded `name` table records map (after NameTable.process). */
|
|
174
|
+
export interface NameRecords {
|
|
175
|
+
fontFeatures?: Record<string | number, NameLocaleMap>;
|
|
176
|
+
reservedNameID?: Record<string | number, NameLocaleMap>;
|
|
177
|
+
copyright?: NameLocaleMap;
|
|
178
|
+
fontFamily?: NameLocaleMap;
|
|
179
|
+
fontSubfamily?: NameLocaleMap;
|
|
180
|
+
fullName?: NameLocaleMap;
|
|
181
|
+
postscriptName?: NameLocaleMap;
|
|
182
|
+
version?: NameLocaleMap;
|
|
183
|
+
[key: string]: NameLocaleMap | Record<string | number, NameLocaleMap> | undefined;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Name table surface used by TTFFont.getName. */
|
|
187
|
+
export interface NameTable {
|
|
188
|
+
records: NameRecords;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Value stored in a name record (decoded string or raw bytes). */
|
|
192
|
+
export type NameString = string | BinaryBuffer;
|
|
193
|
+
|
|
194
|
+
/** post table glyph naming / underline fields. */
|
|
195
|
+
export interface PostTable {
|
|
196
|
+
version: number;
|
|
197
|
+
italicAngle: number;
|
|
198
|
+
underlinePosition: number;
|
|
199
|
+
underlineThickness: number;
|
|
200
|
+
glyphNameIndex?: number[];
|
|
201
|
+
names?: string[];
|
|
202
|
+
offsets?: number[];
|
|
203
|
+
map?: number[];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** loca glyph offsets. */
|
|
207
|
+
export interface LocaTable {
|
|
208
|
+
offsets: number[];
|
|
209
|
+
version?: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Lazy number array surface from restructure LazyArray. */
|
|
213
|
+
export interface LazyNumberArray {
|
|
214
|
+
length: number;
|
|
215
|
+
get(index: number): number | undefined;
|
|
216
|
+
toArray(): number[];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** cmap coverage group (formats 12/13). */
|
|
220
|
+
export interface CmapGroup {
|
|
221
|
+
startCharCode: number;
|
|
222
|
+
endCharCode: number;
|
|
223
|
+
glyphID: number;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface LazyCmapGroupArray {
|
|
227
|
+
length: number;
|
|
228
|
+
get(index: number): CmapGroup | undefined;
|
|
229
|
+
toArray(): CmapGroup[];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface CmapDefaultUVSRange {
|
|
233
|
+
startUnicodeValue: number;
|
|
234
|
+
additionalCount: number;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface CmapUVSMapping {
|
|
238
|
+
unicodeValue: number;
|
|
239
|
+
glyphID: number;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface CmapVarSelector {
|
|
243
|
+
varSelector: number;
|
|
244
|
+
defaultUVS?: CmapDefaultUVSRange[] | null;
|
|
245
|
+
nonDefaultUVS?: CmapUVSMapping[] | null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface LazyVarSelectorArray {
|
|
249
|
+
length: number;
|
|
250
|
+
get(index: number): CmapVarSelector | undefined;
|
|
251
|
+
toArray(): CmapVarSelector[];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Discriminated cmap subtable formats used by CmapProcessor. */
|
|
255
|
+
export interface CmapSubtable0 {
|
|
256
|
+
version: 0;
|
|
257
|
+
language: number;
|
|
258
|
+
codeMap: LazyNumberArray;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface CmapSubtable4 {
|
|
262
|
+
version: 4;
|
|
263
|
+
language: number;
|
|
264
|
+
segCount: number;
|
|
265
|
+
endCode: LazyNumberArray;
|
|
266
|
+
startCode: LazyNumberArray;
|
|
267
|
+
idDelta: LazyNumberArray;
|
|
268
|
+
idRangeOffset: LazyNumberArray;
|
|
269
|
+
glyphIndexArray: LazyNumberArray;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface CmapSubtable6 {
|
|
273
|
+
version: 6;
|
|
274
|
+
language: number;
|
|
275
|
+
firstCode: number;
|
|
276
|
+
glyphIndices: LazyNumberArray;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface CmapSubtable8 {
|
|
280
|
+
version: 8;
|
|
281
|
+
language: number;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface CmapSubtable10 {
|
|
285
|
+
version: 10;
|
|
286
|
+
language: number;
|
|
287
|
+
firstCode: number;
|
|
288
|
+
glyphIndices: LazyNumberArray;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface CmapSubtable12 {
|
|
292
|
+
version: 12;
|
|
293
|
+
language: number;
|
|
294
|
+
nGroups: number;
|
|
295
|
+
groups: LazyCmapGroupArray;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface CmapSubtable13 {
|
|
299
|
+
version: 13;
|
|
300
|
+
language: number;
|
|
301
|
+
nGroups: number;
|
|
302
|
+
groups: LazyCmapGroupArray;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface CmapSubtable14 {
|
|
306
|
+
version: 14;
|
|
307
|
+
varSelectors: LazyVarSelectorArray;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export type CmapSubtable =
|
|
311
|
+
| CmapSubtable0
|
|
312
|
+
| CmapSubtable4
|
|
313
|
+
| CmapSubtable6
|
|
314
|
+
| CmapSubtable8
|
|
315
|
+
| CmapSubtable10
|
|
316
|
+
| CmapSubtable12
|
|
317
|
+
| CmapSubtable13
|
|
318
|
+
| CmapSubtable14;
|
|
319
|
+
|
|
320
|
+
export interface CmapTableEntry {
|
|
321
|
+
platformID: number;
|
|
322
|
+
encodingID: number;
|
|
323
|
+
table: CmapSubtable;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** Top-level cmap table. */
|
|
327
|
+
export interface CmapTable {
|
|
328
|
+
version?: number;
|
|
329
|
+
numSubtables?: number;
|
|
330
|
+
tables: CmapTableEntry[];
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** CPAL palette color. */
|
|
334
|
+
export interface CPALColor {
|
|
335
|
+
red: number;
|
|
336
|
+
green: number;
|
|
337
|
+
blue: number;
|
|
338
|
+
alpha: number;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface COLRBaseGlyphRecord {
|
|
342
|
+
gid: number;
|
|
343
|
+
firstLayerIndex: number;
|
|
344
|
+
numLayers: number;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface COLRLayerRecord {
|
|
348
|
+
gid: number;
|
|
349
|
+
paletteIndex: number;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export interface COLRTable {
|
|
353
|
+
version?: number;
|
|
354
|
+
baseGlyphRecord?: COLRBaseGlyphRecord[] | null;
|
|
355
|
+
layerRecords: COLRLayerRecord[];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface CPALTable {
|
|
359
|
+
colorRecords: CPALColor[];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface SBIXImageTable {
|
|
363
|
+
ppem: number;
|
|
364
|
+
resolution?: number;
|
|
365
|
+
imageOffsets: number[];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface SBIXTable {
|
|
369
|
+
imageTables: SBIXImageTable[];
|
|
370
|
+
flags: { renderOutlines: boolean };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export interface SBIXImage {
|
|
374
|
+
originX: number;
|
|
375
|
+
originY: number;
|
|
376
|
+
type: string;
|
|
377
|
+
data: BinaryBuffer;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface FvarAxis {
|
|
381
|
+
axisTag: string;
|
|
382
|
+
minValue: number;
|
|
383
|
+
defaultValue: number;
|
|
384
|
+
maxValue: number;
|
|
385
|
+
name?: NameLocaleMap;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface FvarInstance {
|
|
389
|
+
name: NameLocaleMap;
|
|
390
|
+
coord: number[];
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface FvarTable {
|
|
394
|
+
axis: FvarAxis[];
|
|
395
|
+
instance: FvarInstance[];
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export interface AvarCorrespondence {
|
|
399
|
+
fromCoord: number;
|
|
400
|
+
toCoord: number;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export interface AvarSegment {
|
|
404
|
+
correspondence: AvarCorrespondence[];
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface AvarTable {
|
|
408
|
+
segment: AvarSegment[];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface GvarTable {
|
|
412
|
+
glyphCount: number;
|
|
413
|
+
offsets: number[];
|
|
414
|
+
axisCount: number;
|
|
415
|
+
globalCoordCount: number;
|
|
416
|
+
globalCoords: number[][];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface ItemVariationRegionAxis {
|
|
420
|
+
startCoord: number;
|
|
421
|
+
peakCoord: number;
|
|
422
|
+
endCoord: number;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export interface ItemVariationDeltaSet {
|
|
426
|
+
deltas: number[];
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export interface ItemVariationData {
|
|
430
|
+
deltaSets: ItemVariationDeltaSet[];
|
|
431
|
+
regionIndexCount: number;
|
|
432
|
+
regionIndexes: number[];
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface ItemVariationStore {
|
|
436
|
+
itemVariationData: ItemVariationData[];
|
|
437
|
+
variationRegionList: {
|
|
438
|
+
variationRegions: ItemVariationRegionAxis[][];
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export interface DeltaSetIndexMapEntry {
|
|
443
|
+
outerIndex: number;
|
|
444
|
+
innerIndex: number;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface DeltaSetIndexMap {
|
|
448
|
+
mapCount: number;
|
|
449
|
+
mapData: DeltaSetIndexMapEntry[];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export interface HVARTable {
|
|
453
|
+
advanceWidthMapping?: DeltaSetIndexMap;
|
|
454
|
+
itemVariationStore: ItemVariationStore;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** Contour point used by TrueType / variation processing. */
|
|
458
|
+
export interface GlyphPoint {
|
|
459
|
+
onCurve: boolean;
|
|
460
|
+
endContour: boolean;
|
|
461
|
+
x: number;
|
|
462
|
+
y: number;
|
|
463
|
+
copy(): GlyphPoint;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/** Composite glyph component. */
|
|
467
|
+
export interface GlyphComponent {
|
|
468
|
+
glyphID: number;
|
|
469
|
+
dx: number;
|
|
470
|
+
dy: number;
|
|
471
|
+
pos: number;
|
|
472
|
+
scaleX: number;
|
|
473
|
+
scaleY: number;
|
|
474
|
+
scale01: number;
|
|
475
|
+
scale10: number;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** Decoded glyf (simple or composite), including variation phantoms. */
|
|
479
|
+
export interface DecodedGlyf {
|
|
480
|
+
numberOfContours: number;
|
|
481
|
+
xMin: number;
|
|
482
|
+
yMin: number;
|
|
483
|
+
xMax: number;
|
|
484
|
+
yMax: number;
|
|
485
|
+
points?: GlyphPoint[];
|
|
486
|
+
components?: GlyphComponent[];
|
|
487
|
+
phantomPoints?: GlyphPoint[];
|
|
488
|
+
instructions?: number[];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface CFFCharString {
|
|
492
|
+
offset: number;
|
|
493
|
+
length: number;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface CFFPrivateDict {
|
|
497
|
+
/** Decoded ranges, or raw charstring buffers after subsetting. */
|
|
498
|
+
Subrs?: CFFCharString[] | BinaryBuffer[];
|
|
499
|
+
nominalWidthX?: number;
|
|
500
|
+
vsindex?: number;
|
|
501
|
+
[key: string]: unknown;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export interface CFFTopDict {
|
|
505
|
+
CharStrings: CFFCharString[] | unknown[];
|
|
506
|
+
Private?: CFFPrivateDict | null;
|
|
507
|
+
FDArray?: Array<StructValue & { Private?: CFFPrivateDict; FontName?: unknown }>;
|
|
508
|
+
FDSelect?: StructValue & {
|
|
509
|
+
version?: number;
|
|
510
|
+
fds?: number[];
|
|
511
|
+
ranges?: Array<{ first: number; fd: number; offset?: number }>;
|
|
512
|
+
nRanges?: number;
|
|
513
|
+
sentinel?: number;
|
|
514
|
+
};
|
|
515
|
+
charset?: unknown;
|
|
516
|
+
Encoding?: unknown;
|
|
517
|
+
FullName?: number | null;
|
|
518
|
+
FamilyName?: number | null;
|
|
519
|
+
ROS?: unknown;
|
|
520
|
+
CIDCount?: number;
|
|
521
|
+
vstore?: { itemVariationStore?: ItemVariationStore } | null;
|
|
522
|
+
[key: string]: unknown;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* CFF / CFF2 font surface used by CFFGlyph and CFFSubset.
|
|
527
|
+
* Optional members cover both decode-time getters and subset encode paths.
|
|
528
|
+
*/
|
|
529
|
+
export interface CFFFontLike {
|
|
530
|
+
stream: DecodeStream;
|
|
531
|
+
version?: number;
|
|
532
|
+
hdrSize?: number;
|
|
533
|
+
header?: unknown;
|
|
534
|
+
isCIDFont?: boolean;
|
|
535
|
+
topDict: CFFTopDict;
|
|
536
|
+
topDictIndex?: StructValue[];
|
|
537
|
+
nameIndex?: string[];
|
|
538
|
+
stringIndex?: string[];
|
|
539
|
+
globalSubrIndex?: CFFCharString[] | { length: number; [index: number]: CFFCharString | undefined };
|
|
540
|
+
postscriptName?: string | null;
|
|
541
|
+
getCharString?(glyph: number): BinaryBuffer;
|
|
542
|
+
string?(sid: number | null | undefined): string | null;
|
|
543
|
+
getGlyphName?(gid: number): string | null | undefined;
|
|
544
|
+
fdForGlyph?(gid: number): number | null;
|
|
545
|
+
privateDictForGlyph(gid: number): CFFPrivateDict | null | undefined;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/** Variation processor methods used from glyphs and GPOS. */
|
|
549
|
+
export interface GlyphVariationProcessorLike {
|
|
550
|
+
normalizedCoords?: number[];
|
|
551
|
+
getAdvanceAdjustment(gid: number, table: HVARTable): number;
|
|
552
|
+
transformPoints(gid: number, points: GlyphPoint[]): void;
|
|
553
|
+
getBlendVector(itemStore: ItemVariationStore, outerIndex: number): number[];
|
|
554
|
+
getDelta(itemStore: ItemVariationStore, outerIndex: number, innerIndex: number): number;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** Axis-aligned box used by glyph metrics / Unicode mark positioning. */
|
|
558
|
+
export interface BBoxLike {
|
|
559
|
+
minX: number;
|
|
560
|
+
minY: number;
|
|
561
|
+
maxX: number;
|
|
562
|
+
maxY: number;
|
|
563
|
+
width: number;
|
|
564
|
+
height: number;
|
|
565
|
+
copy(): BBoxLike;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Glyph surface referenced by FontLike without importing Glyph.js
|
|
570
|
+
* (avoids circular type refs with TTFFont).
|
|
571
|
+
*/
|
|
572
|
+
export interface GlyphLike {
|
|
573
|
+
id: number;
|
|
574
|
+
codePoints?: number[];
|
|
575
|
+
advanceWidth?: number;
|
|
576
|
+
isMark?: boolean;
|
|
577
|
+
isLigature?: boolean;
|
|
578
|
+
cbox?: BBoxLike;
|
|
579
|
+
bbox: { minX: number; minY: number; maxX: number; maxY: number; width?: number; height?: number };
|
|
580
|
+
path: {
|
|
581
|
+
commands: PathCommand[];
|
|
582
|
+
translate(x: number, y: number): { commands: PathCommand[] };
|
|
583
|
+
scale(scaleX: number, scaleY?: number): unknown;
|
|
584
|
+
};
|
|
585
|
+
render(ctx: PathRenderingContext, size: number): void;
|
|
586
|
+
_getContours?(): GlyphPoint[][];
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/** Glyph used during layout (TTF Glyph or similar). */
|
|
590
|
+
export interface LayoutGlyph extends GlyphLike {
|
|
591
|
+
codePoints: number[];
|
|
592
|
+
advanceWidth: number;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Partial glyf payload produced by WOFF2 `_transformGlyfTable`
|
|
597
|
+
* (bbox filled in later by WOFF2Glyph._decode when needed).
|
|
598
|
+
*/
|
|
599
|
+
export type TransformedGlyf = Pick<DecodedGlyf, 'numberOfContours'> &
|
|
600
|
+
Partial<Omit<DecodedGlyf, 'numberOfContours'>>;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Minimal font surface used by Glyph and subclasses.
|
|
604
|
+
* Prefer this over importing TTFFont to avoid circular refs.
|
|
605
|
+
* SFNT tables are optional on the type when installed as lazy getters.
|
|
606
|
+
*/
|
|
607
|
+
export interface FontLike {
|
|
608
|
+
stream: DecodeStream;
|
|
609
|
+
directory: FontDirectory;
|
|
610
|
+
unitsPerEm: number;
|
|
611
|
+
ascent: number;
|
|
612
|
+
descent: number;
|
|
613
|
+
numGlyphs: number;
|
|
614
|
+
variationCoords?: VariationCoords;
|
|
615
|
+
cmap?: CmapTable;
|
|
616
|
+
head: HeadTable;
|
|
617
|
+
hhea?: HheaTable;
|
|
618
|
+
hmtx: MetricsTable;
|
|
619
|
+
maxp?: MaxpTable;
|
|
620
|
+
name?: NameTable;
|
|
621
|
+
'OS/2'?: OS2Table;
|
|
622
|
+
post?: PostTable;
|
|
623
|
+
loca?: LocaTable;
|
|
624
|
+
glyf?: unknown;
|
|
625
|
+
vmtx?: MetricsTable;
|
|
626
|
+
vhea?: StructValue;
|
|
627
|
+
HVAR?: HVARTable;
|
|
628
|
+
fvar?: FvarTable;
|
|
629
|
+
avar?: AvarTable;
|
|
630
|
+
gvar?: GvarTable;
|
|
631
|
+
sbix?: SBIXTable;
|
|
632
|
+
COLR?: COLRTable;
|
|
633
|
+
CPAL?: CPALTable;
|
|
634
|
+
CBLC?: StructValue;
|
|
635
|
+
EBLC?: StructValue;
|
|
636
|
+
CFF2?: CFFFontLike;
|
|
637
|
+
'CFF '?: CFFFontLike;
|
|
638
|
+
GSUB?: OTLayoutTable;
|
|
639
|
+
GPOS?: OTLayoutTable;
|
|
640
|
+
GDEF?: GDEFTable;
|
|
641
|
+
kern?: KernTable;
|
|
642
|
+
morx?: MorxTable;
|
|
643
|
+
prep?: unknown;
|
|
644
|
+
fpgm?: unknown;
|
|
645
|
+
'cvt '?: unknown;
|
|
646
|
+
_variationProcessor?: GlyphVariationProcessorLike | null;
|
|
647
|
+
_transformedGlyphs?: (TransformedGlyf | undefined)[];
|
|
648
|
+
_decompress?(): void;
|
|
649
|
+
_getTableStream(tag: string): DecodeStream | null;
|
|
650
|
+
_getBaseGlyph(glyph: number, characters?: number[]): GlyphLike | null | undefined;
|
|
651
|
+
getGlyph(glyph: number, characters?: number[]): LayoutGlyph | null;
|
|
652
|
+
hasGlyphForCodePoint?(codePoint: number): boolean;
|
|
653
|
+
glyphsForString?(string: string): LayoutGlyph[];
|
|
654
|
+
glyphForCodePoint?(codePoint: number): LayoutGlyph | null;
|
|
655
|
+
_cmapProcessor?: {
|
|
656
|
+
codePointsForGlyph(gid: number): number[];
|
|
657
|
+
lookup(codePoint: number, variationSelector?: number): number;
|
|
658
|
+
};
|
|
659
|
+
_layoutEngine?: LayoutEngineHost;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/** Font surface required by layout / OpenType processors. */
|
|
663
|
+
export interface LayoutFont extends FontLike {
|
|
664
|
+
glyphsForString(string: string): LayoutGlyph[];
|
|
665
|
+
glyphForCodePoint(codePoint: number): LayoutGlyph | null;
|
|
666
|
+
hasGlyphForCodePoint(codePoint: number): boolean;
|
|
667
|
+
getGlyph(glyph: number, characters?: number[]): LayoutGlyph | null;
|
|
668
|
+
_cmapProcessor: {
|
|
669
|
+
codePointsForGlyph(gid: number): number[];
|
|
670
|
+
lookup(codePoint: number, variationSelector?: number): number;
|
|
671
|
+
};
|
|
672
|
+
_layoutEngine: LayoutEngineHost;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/** Map of OpenType table tag → decoded table object. */
|
|
676
|
+
export type DecodedTables = Record<string, StructValue | undefined>;
|
|
677
|
+
|
|
678
|
+
/** Table codec registry entry. */
|
|
679
|
+
export interface TableCodec {
|
|
680
|
+
decode(stream: DecodeStream, font?: unknown, length?: number): unknown;
|
|
681
|
+
encode?(stream: EncodeStream, value?: unknown, font?: unknown): unknown;
|
|
682
|
+
size?(value?: unknown, font?: unknown): number;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/** Font or collection instance returned by create() / open(). */
|
|
686
|
+
export interface OpenedFont {
|
|
687
|
+
getFont(
|
|
688
|
+
postscriptName: string | Uint8Array | Record<string, number>
|
|
689
|
+
): OpenedFont | null | undefined;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** Registered font format: constructible from a DecodeStream with a static probe. */
|
|
693
|
+
export interface FontFormat {
|
|
694
|
+
new (stream: DecodeStream, variationCoords?: number[] | null): OpenedFont;
|
|
695
|
+
probe(buffer: ArrayBufferView): boolean;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/** CFF dict operator key: single byte or two-byte escape. */
|
|
699
|
+
export type CFFOpKey = number | [number, number];
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Operand type for a CFF dict operator: a named primitive, a codec, or a
|
|
703
|
+
* parallel list of operand types (e.g. ROS = sid + sid + number).
|
|
704
|
+
*/
|
|
705
|
+
export type CFFOperandType =
|
|
706
|
+
| 'number'
|
|
707
|
+
| 'offset'
|
|
708
|
+
| 'sid'
|
|
709
|
+
| 'boolean'
|
|
710
|
+
| 'array'
|
|
711
|
+
| 'delta'
|
|
712
|
+
| BaseType
|
|
713
|
+
| CFFOperandType[];
|
|
714
|
+
|
|
715
|
+
/** One CFF dict field: [key, name, type, defaultValue]. */
|
|
716
|
+
export type CFFDictField = [CFFOpKey, string, CFFOperandType, unknown];
|
|
717
|
+
|
|
718
|
+
/** Context used while sizing/encoding CFF dicts and pointers. */
|
|
719
|
+
export interface CFFEncodeContext extends StructValue {
|
|
720
|
+
pointers: Array<{ type: BaseType; val: unknown; parent: StructValue }>;
|
|
721
|
+
startOffset: number;
|
|
722
|
+
pointerSize: number;
|
|
723
|
+
pointerOffset?: number;
|
|
724
|
+
val?: unknown;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/** Glyph object surface used by subsetters. */
|
|
728
|
+
export interface SubsetGlyph {
|
|
729
|
+
id: number;
|
|
730
|
+
path: unknown;
|
|
731
|
+
advanceWidth: number;
|
|
732
|
+
_usedGsubrs?: Record<string, boolean>;
|
|
733
|
+
_usedSubrs?: Record<string, boolean>;
|
|
734
|
+
_decode?(): DecodedGlyf | null;
|
|
735
|
+
_getMetrics(): GlyphMetrics;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Minimal font surface required by Subset / TTFSubset / CFFSubset.
|
|
740
|
+
* Intentionally structural so TTFFont (and friends) satisfy it without casts.
|
|
741
|
+
*/
|
|
742
|
+
export interface SubsetFont {
|
|
743
|
+
directory: FontDirectory;
|
|
744
|
+
getGlyph(glyph: number, characters?: number[]): SubsetGlyph | null;
|
|
745
|
+
_getTableStream(tag: string): DecodeStream | null;
|
|
746
|
+
_variationProcessor?: unknown;
|
|
747
|
+
loca?: { offsets: number[]; version?: number };
|
|
748
|
+
maxp?: MaxpTable | StructValue;
|
|
749
|
+
head?: HeadTable | StructValue;
|
|
750
|
+
hhea?: HheaTable | StructValue;
|
|
751
|
+
prep?: unknown;
|
|
752
|
+
fpgm?: unknown;
|
|
753
|
+
'cvt '?: unknown;
|
|
754
|
+
'CFF '?: CFFFontLike;
|
|
755
|
+
CFF2?: CFFFontLike;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// ---------------------------------------------------------------------------
|
|
759
|
+
// OpenType layout (GSUB / GPOS / GDEF) and kerning
|
|
760
|
+
// ---------------------------------------------------------------------------
|
|
761
|
+
|
|
762
|
+
/** Lazy random-access list (restructure LazyArray surface). */
|
|
763
|
+
export interface LazyList<T> {
|
|
764
|
+
get(index: number): T;
|
|
765
|
+
length?: number;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/** Coverage table (format 1 glyphs list / format 2 ranges). */
|
|
769
|
+
export interface CoverageTable {
|
|
770
|
+
version: number;
|
|
771
|
+
glyphs?: number[];
|
|
772
|
+
rangeRecords?: Array<{ start: number; end: number; startCoverageIndex: number }>;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/** ClassDef table. */
|
|
776
|
+
export interface ClassDefTable {
|
|
777
|
+
version: number;
|
|
778
|
+
startGlyph?: number;
|
|
779
|
+
classValueArray?: number[];
|
|
780
|
+
classRangeRecord?: Array<{ start: number; end: number; class: number }>;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/** Device / variation index pair used by GPOS anchors and value records. */
|
|
784
|
+
export interface DeviceTable {
|
|
785
|
+
a: number;
|
|
786
|
+
b: number;
|
|
787
|
+
[key: string]: unknown;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/** GPOS value record (placement / advance deltas). */
|
|
791
|
+
export interface PositionValue {
|
|
792
|
+
xAdvance?: number | null;
|
|
793
|
+
yAdvance?: number | null;
|
|
794
|
+
xPlacement?: number | null;
|
|
795
|
+
yPlacement?: number | null;
|
|
796
|
+
xPlaDevice?: DeviceTable | null;
|
|
797
|
+
yPlaDevice?: DeviceTable | null;
|
|
798
|
+
xAdvDevice?: DeviceTable | null;
|
|
799
|
+
yAdvDevice?: DeviceTable | null;
|
|
800
|
+
[key: string]: unknown;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/** GPOS anchor point. */
|
|
804
|
+
export interface AnchorPoint {
|
|
805
|
+
xCoordinate: number;
|
|
806
|
+
yCoordinate: number;
|
|
807
|
+
xDeviceTable?: DeviceTable | null;
|
|
808
|
+
yDeviceTable?: DeviceTable | null;
|
|
809
|
+
[key: string]: unknown;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/** Mark array record (GPOS types 4–6). */
|
|
813
|
+
export interface MarkRecord {
|
|
814
|
+
class: number;
|
|
815
|
+
markAnchor: AnchorPoint | null;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/** Lookup flag bitfield surface. */
|
|
819
|
+
export interface LookupFlags {
|
|
820
|
+
ignoreBaseGlyphs?: boolean;
|
|
821
|
+
ignoreLigatures?: boolean;
|
|
822
|
+
ignoreMarks?: boolean;
|
|
823
|
+
useMarkFilteringSet?: boolean;
|
|
824
|
+
rightToLeft?: boolean;
|
|
825
|
+
[key: string]: boolean | undefined;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/** GlyphIterator / lookup options. */
|
|
829
|
+
export interface GlyphIteratorOptions {
|
|
830
|
+
flags?: LookupFlags;
|
|
831
|
+
markAttachmentType?: number;
|
|
832
|
+
[key: string]: unknown;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/** Decoded OpenType lookup. */
|
|
836
|
+
export interface OTLookup {
|
|
837
|
+
lookupType: number;
|
|
838
|
+
flags: GlyphIteratorOptions & { flags?: LookupFlags };
|
|
839
|
+
markFilteringSet?: number;
|
|
840
|
+
subTables: StructValue[];
|
|
841
|
+
[key: string]: unknown;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/** Feature table. */
|
|
845
|
+
export interface OTFeature {
|
|
846
|
+
featureParams?: unknown;
|
|
847
|
+
lookupListIndexes: number[];
|
|
848
|
+
[key: string]: unknown;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
export interface OTFeatureRecord {
|
|
852
|
+
tag: string;
|
|
853
|
+
feature: OTFeature;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
export interface OTLangSys {
|
|
857
|
+
featureIndexes: number[];
|
|
858
|
+
reqFeatureIndex?: number;
|
|
859
|
+
[key: string]: unknown;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
export interface OTLangSysRecord {
|
|
863
|
+
tag: string;
|
|
864
|
+
langSys: OTLangSys;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
export interface OTScript {
|
|
868
|
+
defaultLangSys: OTLangSys | null;
|
|
869
|
+
langSysRecords: OTLangSysRecord[];
|
|
870
|
+
[key: string]: unknown;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
export interface OTScriptRecord {
|
|
874
|
+
tag: string;
|
|
875
|
+
script: OTScript;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
export interface OTLookupList {
|
|
879
|
+
get(index: number): OTLookup;
|
|
880
|
+
length?: number;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/** FeatureVariations condition. */
|
|
884
|
+
export interface FeatureVariationCondition {
|
|
885
|
+
axisIndex: number;
|
|
886
|
+
filterRangeMinValue: number;
|
|
887
|
+
filterRangeMaxValue: number;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
export interface FeatureVariationRecord {
|
|
891
|
+
conditionSet: { conditionTable: FeatureVariationCondition[] };
|
|
892
|
+
featureTableSubstitution: {
|
|
893
|
+
substitutions: Array<{ featureIndex: number; alternateFeatureTable: OTFeature }>;
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
export interface FeatureVariationsTable {
|
|
898
|
+
featureVariationRecords: FeatureVariationRecord[];
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/** Shared GSUB/GPOS table header surface. */
|
|
902
|
+
export interface OTLayoutTable {
|
|
903
|
+
scriptList: OTScriptRecord[] | null;
|
|
904
|
+
featureList: OTFeatureRecord[];
|
|
905
|
+
lookupList: OTLookupList;
|
|
906
|
+
featureVariations?: FeatureVariationsTable | null;
|
|
907
|
+
[key: string]: unknown;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
/** GDEF table surface used by GlyphInfo / GPOS. */
|
|
911
|
+
export interface GDEFTable {
|
|
912
|
+
glyphClassDef?: ClassDefTable | null;
|
|
913
|
+
markAttachClassDef?: ClassDefTable | null;
|
|
914
|
+
markGlyphSetsDef?: {
|
|
915
|
+
coverage?: Array<CoverageTable | null | undefined>;
|
|
916
|
+
} | null;
|
|
917
|
+
itemVariationStore?: ItemVariationStore;
|
|
918
|
+
[key: string]: unknown;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/** Context / chaining lookup record. */
|
|
922
|
+
export interface LookupRecord {
|
|
923
|
+
sequenceIndex: number;
|
|
924
|
+
lookupListIndex: number;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
export interface ContextRule {
|
|
928
|
+
input: number[];
|
|
929
|
+
lookupRecords: LookupRecord[];
|
|
930
|
+
classes?: number[];
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export interface ContextSubtable {
|
|
934
|
+
version: number;
|
|
935
|
+
coverage: CoverageTable;
|
|
936
|
+
ruleSets?: Array<ContextRule[] | null | undefined>;
|
|
937
|
+
classDef?: ClassDefTable;
|
|
938
|
+
classSet?: Array<ContextRule[] | null | undefined>;
|
|
939
|
+
coverages?: CoverageTable[];
|
|
940
|
+
lookupRecords?: LookupRecord[];
|
|
941
|
+
[key: string]: unknown;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
export interface ChainContextRule {
|
|
945
|
+
backtrack: number[];
|
|
946
|
+
input: number[];
|
|
947
|
+
lookahead: number[];
|
|
948
|
+
lookupRecords: LookupRecord[];
|
|
949
|
+
classes?: number[];
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
export interface ChainContextSubtable {
|
|
953
|
+
version: number;
|
|
954
|
+
coverage: CoverageTable;
|
|
955
|
+
chainRuleSets?: Array<ChainContextRule[] | null | undefined>;
|
|
956
|
+
inputClassDef?: ClassDefTable | null;
|
|
957
|
+
/** May be NULL (offset 0) when backtrack is unused. */
|
|
958
|
+
backtrackClassDef?: ClassDefTable | null;
|
|
959
|
+
/** May be NULL (offset 0) when lookahead is unused. */
|
|
960
|
+
lookaheadClassDef?: ClassDefTable | null;
|
|
961
|
+
chainClassSet?: Array<ChainContextRule[] | null | undefined>;
|
|
962
|
+
backtrackGlyphCount?: number;
|
|
963
|
+
backtrackCoverage?: CoverageTable[];
|
|
964
|
+
inputGlyphCount?: number;
|
|
965
|
+
inputCoverage?: CoverageTable[];
|
|
966
|
+
lookaheadCoverage?: CoverageTable[];
|
|
967
|
+
lookupRecords?: LookupRecord[];
|
|
968
|
+
[key: string]: unknown;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/** Extension subtable wrapper (GSUB/GPOS type 7/9). */
|
|
972
|
+
export interface ExtensionSubtable {
|
|
973
|
+
lookupType: number;
|
|
974
|
+
extension: StructValue;
|
|
975
|
+
[key: string]: unknown;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/** Planned lookup application entry. */
|
|
979
|
+
export interface FeatureLookup {
|
|
980
|
+
feature: string;
|
|
981
|
+
index: number;
|
|
982
|
+
lookup: OTLookup;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/** GlyphInfo-like surface used while shaping. */
|
|
986
|
+
export interface GlyphInfoLike {
|
|
987
|
+
id: number;
|
|
988
|
+
codePoints: number[];
|
|
989
|
+
features: FeatureMap;
|
|
990
|
+
isMark: boolean;
|
|
991
|
+
isBase: boolean;
|
|
992
|
+
isLigature: boolean;
|
|
993
|
+
markAttachmentType: number;
|
|
994
|
+
ligatureID: number | null;
|
|
995
|
+
ligatureComponent: number | null;
|
|
996
|
+
isLigated: boolean;
|
|
997
|
+
cursiveAttachment: number | null;
|
|
998
|
+
markAttachment: number | null;
|
|
999
|
+
shaperInfo: IndicShaperInfo | USEShaperInfo | null;
|
|
1000
|
+
substituted: boolean;
|
|
1001
|
+
isMultiplied: boolean;
|
|
1002
|
+
/** Owning font (GlyphInfo); used by Indic wouldSubstitute probes. */
|
|
1003
|
+
_font: LayoutFont;
|
|
1004
|
+
copy(): GlyphInfoLike;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/** Glyph position surface (matches GlyphPosition). */
|
|
1008
|
+
export interface GlyphPositionLike {
|
|
1009
|
+
xAdvance: number;
|
|
1010
|
+
yAdvance: number;
|
|
1011
|
+
xOffset: number;
|
|
1012
|
+
yOffset: number;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/** GlyphRun surface used by layout engines. */
|
|
1016
|
+
export interface GlyphRunLike {
|
|
1017
|
+
glyphs: Array<LayoutGlyph | GlyphInfoLike>;
|
|
1018
|
+
positions: GlyphPositionLike[] | null;
|
|
1019
|
+
features: FeatureMap;
|
|
1020
|
+
script: ScriptTag | string[] | null | undefined;
|
|
1021
|
+
language: LanguageTag | null;
|
|
1022
|
+
direction: TextDirection;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/** Optional advanced layout backend (AAT or OpenType). */
|
|
1026
|
+
export interface AdvancedLayoutEngine {
|
|
1027
|
+
fallbackPosition?: boolean;
|
|
1028
|
+
setup?(glyphRun: GlyphRunLike): void;
|
|
1029
|
+
cleanup?(): void;
|
|
1030
|
+
substitute?(glyphRun: GlyphRunLike): void;
|
|
1031
|
+
/** GPOS returns applied feature records; truthiness / `.kern` checked by LayoutEngine. */
|
|
1032
|
+
position?(glyphRun: GlyphRunLike): FeatureMap | Record<string, OTFeature> | null | undefined | false;
|
|
1033
|
+
getAvailableFeatures(script?: ScriptTag | string[] | null, language?: LanguageTag | null): string[];
|
|
1034
|
+
stringsForGlyph?(gid: number): Iterable<string>;
|
|
1035
|
+
/** Present on OpenType layout engines (not AAT). */
|
|
1036
|
+
GSUBProcessor?: GSUBProcessorLike;
|
|
1037
|
+
GPOSProcessor?: unknown;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/** Indic script config (from indic-data INDIC_CONFIGS). */
|
|
1041
|
+
export interface IndicConfig {
|
|
1042
|
+
hasOldSpec: boolean;
|
|
1043
|
+
virama: number;
|
|
1044
|
+
basePos: string;
|
|
1045
|
+
rephPos: number;
|
|
1046
|
+
rephMode: string;
|
|
1047
|
+
blwfMode: string;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* ShapingPlan surface used by shapers (extra fields set by Indic/Thai).
|
|
1052
|
+
* Mirrors `src/opentype/ShapingPlan.js` plus shaper-owned properties.
|
|
1053
|
+
*/
|
|
1054
|
+
export interface ShapingPlanLike {
|
|
1055
|
+
font: LayoutFont;
|
|
1056
|
+
script: ScriptTag | string[] | null | undefined;
|
|
1057
|
+
direction: TextDirection;
|
|
1058
|
+
stages: ShapingStage[];
|
|
1059
|
+
globalFeatures: FeatureMap;
|
|
1060
|
+
allFeatures: Record<string, number>;
|
|
1061
|
+
userFeatures: FeatureMap | null;
|
|
1062
|
+
bufferScript?: ScriptTag | string[] | null | undefined;
|
|
1063
|
+
/** Unicode script name from Script.fromOpenType (Indic). */
|
|
1064
|
+
unicodeScript?: string;
|
|
1065
|
+
/** Indic shaping config selected for the script. */
|
|
1066
|
+
indicConfig?: IndicConfig;
|
|
1067
|
+
/** True when shaping an old-spec Indic script tag (no trailing '2'). */
|
|
1068
|
+
isOldSpec?: boolean;
|
|
1069
|
+
add(arg: string | string[] | { global?: string[]; local?: string[] }, global?: boolean): void;
|
|
1070
|
+
addStage(
|
|
1071
|
+
arg: string | string[] | { global?: string[]; local?: string[] } | ShapingStageFn,
|
|
1072
|
+
global?: boolean
|
|
1073
|
+
): void;
|
|
1074
|
+
setFeatureOverrides(features: FeatureInput | null | undefined): void;
|
|
1075
|
+
assignGlobalFeatures(glyphs: GlyphInfoLike[]): void;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/** Shaper stage callback. */
|
|
1079
|
+
export type ShapingStageFn = (
|
|
1080
|
+
font: LayoutFont,
|
|
1081
|
+
glyphs: GlyphInfoLike[],
|
|
1082
|
+
plan: ShapingPlanLike
|
|
1083
|
+
) => void;
|
|
1084
|
+
|
|
1085
|
+
export type ShapingStage = string[] | ShapingStageFn;
|
|
1086
|
+
|
|
1087
|
+
/** Shaper class surface (DefaultShaper and friends). */
|
|
1088
|
+
export interface ShaperLike {
|
|
1089
|
+
zeroMarkWidths?: string;
|
|
1090
|
+
plan(
|
|
1091
|
+
plan: ShapingPlanLike,
|
|
1092
|
+
glyphs: GlyphInfoLike[],
|
|
1093
|
+
features: FeatureInput | null | undefined
|
|
1094
|
+
): void;
|
|
1095
|
+
planFeatures?(plan: ShapingPlanLike): void;
|
|
1096
|
+
planPreprocessing?(plan: ShapingPlanLike): void;
|
|
1097
|
+
planPostprocessing?(plan: ShapingPlanLike, userFeatures: FeatureInput | null | undefined): void;
|
|
1098
|
+
assignFeatures?(plan: ShapingPlanLike, glyphs: GlyphInfoLike[]): void;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/** Host layout engine attached to a font (`font._layoutEngine`). */
|
|
1102
|
+
export interface GSUBProcessorLike {
|
|
1103
|
+
features: Record<string, OTFeature | unknown>;
|
|
1104
|
+
applyFeatures(features: string[], glyphs: GlyphInfoLike[], positions?: GlyphPositionLike[] | null): void;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
export interface LayoutEngineBackend {
|
|
1108
|
+
GSUBProcessor: GSUBProcessorLike;
|
|
1109
|
+
GPOSProcessor?: unknown;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
export interface LayoutEngineHost {
|
|
1113
|
+
engine?: AdvancedLayoutEngine | null;
|
|
1114
|
+
layout?(
|
|
1115
|
+
string: string,
|
|
1116
|
+
userFeatures?: FeatureInput | null,
|
|
1117
|
+
script?: ScriptTag | string[] | null,
|
|
1118
|
+
language?: LanguageTag | null,
|
|
1119
|
+
direction?: TextDirection
|
|
1120
|
+
): unknown;
|
|
1121
|
+
stringsForGlyph?(gid: number): Iterable<string>;
|
|
1122
|
+
getAvailableFeatures?(script?: ScriptTag | string[] | null, language?: LanguageTag | null): string[];
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/** AAT UnboundedArray accessor (`src/tables/aat.js`). */
|
|
1126
|
+
export interface AATUnboundedArray<T = unknown> {
|
|
1127
|
+
getItem(index: number): T;
|
|
1128
|
+
base?: number;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/** AAT lookup table binary-search header. */
|
|
1132
|
+
export interface AATBinarySearchHeader {
|
|
1133
|
+
unitSize: number;
|
|
1134
|
+
nUnits: number;
|
|
1135
|
+
searchRange: number;
|
|
1136
|
+
entrySelector: number;
|
|
1137
|
+
rangeShift: number;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
export interface AATLookupSegmentSingle<T = number> {
|
|
1141
|
+
lastGlyph: number;
|
|
1142
|
+
firstGlyph: number;
|
|
1143
|
+
value: T;
|
|
1144
|
+
glyph: number;
|
|
1145
|
+
values: T[];
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/** Decoded AAT lookup table (versioned; unused fields may be absent at runtime). */
|
|
1149
|
+
export interface AATLookupTableData {
|
|
1150
|
+
version: number;
|
|
1151
|
+
values: AATUnboundedArray<number> | number[];
|
|
1152
|
+
binarySearchHeader: AATBinarySearchHeader;
|
|
1153
|
+
segments: AATLookupSegmentSingle[];
|
|
1154
|
+
firstGlyph: number;
|
|
1155
|
+
count?: number;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/** AAT state-table entry (flags + optional contextual/ligature/insertion fields). */
|
|
1159
|
+
export interface AATStateEntry {
|
|
1160
|
+
newState: number;
|
|
1161
|
+
flags: number;
|
|
1162
|
+
markIndex?: number;
|
|
1163
|
+
currentIndex?: number;
|
|
1164
|
+
action?: number;
|
|
1165
|
+
currentInsertIndex?: number;
|
|
1166
|
+
markedInsertIndex?: number;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
export interface AATStateTable {
|
|
1170
|
+
nClasses: number;
|
|
1171
|
+
classTable: AATLookupTableData;
|
|
1172
|
+
stateArray: AATUnboundedArray<number[]>;
|
|
1173
|
+
entryTable: AATUnboundedArray<AATStateEntry>;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
export interface MorxFeatureEntry {
|
|
1177
|
+
featureType: number;
|
|
1178
|
+
featureSetting: number;
|
|
1179
|
+
enableFlags: number;
|
|
1180
|
+
disableFlags: number;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
export interface MorxSubtableTable {
|
|
1184
|
+
stateTable: AATStateTable;
|
|
1185
|
+
substitutionTable: { items: AATUnboundedArray<AATLookupTableData> };
|
|
1186
|
+
ligatureActions: AATUnboundedArray<number>;
|
|
1187
|
+
components: AATUnboundedArray<number>;
|
|
1188
|
+
ligatureList: AATUnboundedArray<number>;
|
|
1189
|
+
lookupTable: AATLookupTableData;
|
|
1190
|
+
insertionActions: AATUnboundedArray<number>;
|
|
1191
|
+
type?: number;
|
|
1192
|
+
[key: string]: unknown;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
export interface MorxSubtable {
|
|
1196
|
+
length: number;
|
|
1197
|
+
coverage: number;
|
|
1198
|
+
type: number;
|
|
1199
|
+
subFeatureFlags: number;
|
|
1200
|
+
table: MorxSubtableTable;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
export interface MorxChain {
|
|
1204
|
+
defaultFlags: number;
|
|
1205
|
+
chainLength: number;
|
|
1206
|
+
nFeatureEntries: number;
|
|
1207
|
+
nSubtables: number;
|
|
1208
|
+
features: MorxFeatureEntry[];
|
|
1209
|
+
subtables: MorxSubtable[];
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
export interface MorxTable {
|
|
1213
|
+
version: number;
|
|
1214
|
+
nChains: number;
|
|
1215
|
+
chains: MorxChain[];
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/** AAT feature enable map: featureType → featureSetting → value. */
|
|
1219
|
+
export type AATFeatureSettings = Record<number, Record<number, FeatureValue>>;
|
|
1220
|
+
|
|
1221
|
+
/** USE / Indic syllable info stored on GlyphInfo.shaperInfo. */
|
|
1222
|
+
export interface USEShaperInfo {
|
|
1223
|
+
category: string;
|
|
1224
|
+
syllableType: string;
|
|
1225
|
+
syllable: number;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
export interface IndicShaperInfo {
|
|
1229
|
+
category: number;
|
|
1230
|
+
position: number;
|
|
1231
|
+
syllableType: string;
|
|
1232
|
+
syllable: number;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* GlyphInfo after Indic `setupSyllables` — `shaperInfo` is always present
|
|
1237
|
+
* and uses numeric category/position flags.
|
|
1238
|
+
*/
|
|
1239
|
+
export type IndicGlyphInfo = Omit<GlyphInfoLike, 'shaperInfo'> & {
|
|
1240
|
+
shaperInfo: IndicShaperInfo;
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* GlyphInfo after USE `setupSyllables` — `shaperInfo` is always present
|
|
1245
|
+
* and uses string categories.
|
|
1246
|
+
*/
|
|
1247
|
+
export type USEGlyphInfo = Omit<GlyphInfoLike, 'shaperInfo'> & {
|
|
1248
|
+
shaperInfo: USEShaperInfo;
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
/**
|
|
1252
|
+
* Shared shaperInfo bag. Indic uses numeric category/position flags;
|
|
1253
|
+
* USE uses string categories. Both shapes are written onto GlyphInfo.
|
|
1254
|
+
*/
|
|
1255
|
+
export interface GlyphShaperInfo {
|
|
1256
|
+
category: number | string;
|
|
1257
|
+
position?: number;
|
|
1258
|
+
syllableType: string;
|
|
1259
|
+
syllable: number;
|
|
1260
|
+
[key: string]: unknown;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/** Mark filtering set used by GlyphIterator. */
|
|
1264
|
+
export interface MarkFilteringSet {
|
|
1265
|
+
has(id: number): boolean;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/** Kern pair (format 0). */
|
|
1269
|
+
export interface KernPair {
|
|
1270
|
+
left: number;
|
|
1271
|
+
right: number;
|
|
1272
|
+
value: number;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
export interface KernClassTable {
|
|
1276
|
+
firstGlyph: number;
|
|
1277
|
+
nGlyphs: number;
|
|
1278
|
+
offsets: number[];
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
export interface KernFormat0 {
|
|
1282
|
+
pairs: KernPair[];
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
export interface KernFormat2 {
|
|
1286
|
+
leftTable: KernClassTable;
|
|
1287
|
+
rightTable: KernClassTable;
|
|
1288
|
+
array: {
|
|
1289
|
+
off: number;
|
|
1290
|
+
values: LazyList<number>;
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
export interface KernFormat3 {
|
|
1295
|
+
glyphCount: number;
|
|
1296
|
+
kernValue: number[];
|
|
1297
|
+
kernIndex: number[];
|
|
1298
|
+
leftClass: number[];
|
|
1299
|
+
rightClass: number[];
|
|
1300
|
+
rightClassCount: number;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
export type KernSubtable = KernFormat0 | KernFormat2 | KernFormat3 | StructValue;
|
|
1304
|
+
|
|
1305
|
+
export interface KernCoverage {
|
|
1306
|
+
horizontal?: boolean;
|
|
1307
|
+
minimum?: boolean;
|
|
1308
|
+
crossStream?: boolean;
|
|
1309
|
+
override?: boolean;
|
|
1310
|
+
variation?: boolean;
|
|
1311
|
+
vertical?: boolean;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
export interface KernSubtableEntry {
|
|
1315
|
+
version: number;
|
|
1316
|
+
format: number;
|
|
1317
|
+
coverage: KernCoverage;
|
|
1318
|
+
subtable: KernSubtable;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
export interface KernTable {
|
|
1322
|
+
tables: KernSubtableEntry[];
|
|
1323
|
+
[key: string]: unknown;
|
|
1324
|
+
}
|