text-shaper 0.0.1
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/LICENSE +21 -0
- package/README.md +161 -0
- package/dist/aat/state-machine.d.ts +34 -0
- package/dist/buffer/glyph-buffer.d.ts +55 -0
- package/dist/buffer/unicode-buffer.d.ts +51 -0
- package/dist/font/binary/reader.d.ts +72 -0
- package/dist/font/face.d.ts +65 -0
- package/dist/font/font.d.ts +189 -0
- package/dist/font/tables/avar.d.ts +36 -0
- package/dist/font/tables/base.d.ts +79 -0
- package/dist/font/tables/cbdt.d.ts +120 -0
- package/dist/font/tables/cff-charstring.d.ts +16 -0
- package/dist/font/tables/cff.d.ts +93 -0
- package/dist/font/tables/cff2.d.ts +85 -0
- package/dist/font/tables/cmap.d.ts +81 -0
- package/dist/font/tables/colr.d.ts +278 -0
- package/dist/font/tables/cpal.d.ts +46 -0
- package/dist/font/tables/feat.d.ts +359 -0
- package/dist/font/tables/fvar.d.ts +77 -0
- package/dist/font/tables/gdef.d.ts +45 -0
- package/dist/font/tables/glyf.d.ts +118 -0
- package/dist/font/tables/gpos-contextual.d.ts +88 -0
- package/dist/font/tables/gpos-mark.d.ts +95 -0
- package/dist/font/tables/gpos.d.ts +137 -0
- package/dist/font/tables/gsub-contextual.d.ts +88 -0
- package/dist/font/tables/gsub.d.ts +107 -0
- package/dist/font/tables/gvar.d.ts +56 -0
- package/dist/font/tables/head.d.ts +47 -0
- package/dist/font/tables/hhea.d.ts +24 -0
- package/dist/font/tables/hmtx.d.ts +23 -0
- package/dist/font/tables/hvar.d.ts +77 -0
- package/dist/font/tables/jstf.d.ts +97 -0
- package/dist/font/tables/kern.d.ts +44 -0
- package/dist/font/tables/kerx.d.ts +108 -0
- package/dist/font/tables/loca.d.ts +31 -0
- package/dist/font/tables/math.d.ts +168 -0
- package/dist/font/tables/maxp.d.ts +27 -0
- package/dist/font/tables/morx.d.ts +142 -0
- package/dist/font/tables/mvar.d.ts +99 -0
- package/dist/font/tables/name.d.ts +75 -0
- package/dist/font/tables/os2.d.ts +102 -0
- package/dist/font/tables/post.d.ts +25 -0
- package/dist/font/tables/sbix.d.ts +65 -0
- package/dist/font/tables/sfnt.d.ts +20 -0
- package/dist/font/tables/stat.d.ts +115 -0
- package/dist/font/tables/svg.d.ts +40 -0
- package/dist/font/tables/trak.d.ts +43 -0
- package/dist/font/tables/vhea.d.ts +41 -0
- package/dist/font/tables/vmtx.d.ts +35 -0
- package/dist/font/tables/vorg.d.ts +33 -0
- package/dist/font/tables/vvar.d.ts +36 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +92 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/layout/justify.d.ts +88 -0
- package/dist/layout/structures/class-def.d.ts +15 -0
- package/dist/layout/structures/coverage.d.ts +17 -0
- package/dist/layout/structures/device.d.ts +58 -0
- package/dist/layout/structures/feature-variations.d.ts +82 -0
- package/dist/layout/structures/layout-common.d.ts +77 -0
- package/dist/render/path.d.ts +136 -0
- package/dist/shaper/complex/arabic.d.ts +60 -0
- package/dist/shaper/complex/ethiopic.d.ts +70 -0
- package/dist/shaper/complex/georgian.d.ts +69 -0
- package/dist/shaper/complex/hangul.d.ts +64 -0
- package/dist/shaper/complex/hebrew.d.ts +28 -0
- package/dist/shaper/complex/indic.d.ts +117 -0
- package/dist/shaper/complex/khmer.d.ts +48 -0
- package/dist/shaper/complex/mongolian.d.ts +89 -0
- package/dist/shaper/complex/myanmar.d.ts +47 -0
- package/dist/shaper/complex/syriac.d.ts +80 -0
- package/dist/shaper/complex/thai-lao.d.ts +42 -0
- package/dist/shaper/complex/tibetan.d.ts +57 -0
- package/dist/shaper/complex/use.d.ts +80 -0
- package/dist/shaper/fallback.d.ts +16 -0
- package/dist/shaper/features.d.ts +189 -0
- package/dist/shaper/shape-plan.d.ts +29 -0
- package/dist/shaper/shaper.d.ts +18 -0
- package/dist/types.d.ts +153 -0
- package/dist/typeshaper.js +7 -0
- package/dist/unicode/bidi/brackets.d.ts +7 -0
- package/dist/unicode/bidi/brackets.data.d.ts +5 -0
- package/dist/unicode/bidi/char-types.d.ts +19 -0
- package/dist/unicode/bidi/char-types.data.d.ts +25 -0
- package/dist/unicode/bidi/embedding-levels.d.ts +18 -0
- package/dist/unicode/bidi/index.d.ts +9 -0
- package/dist/unicode/bidi/mirroring.d.ts +10 -0
- package/dist/unicode/bidi/mirroring.data.d.ts +2 -0
- package/dist/unicode/bidi/parse-character-map.d.ts +8 -0
- package/dist/unicode/bidi/reordering.d.ts +18 -0
- package/dist/unicode/bidi.d.ts +93 -0
- package/dist/unicode/line-break.d.ts +113 -0
- package/dist/unicode/normalize.d.ts +36 -0
- package/dist/unicode/script.d.ts +215 -0
- package/dist/unicode/segmentation.d.ts +104 -0
- package/package.json +33 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import type { GlyphId } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* COLR (Color) table parser
|
|
5
|
+
* Defines color glyph layers
|
|
6
|
+
*/
|
|
7
|
+
export interface ColrTable {
|
|
8
|
+
version: number;
|
|
9
|
+
baseGlyphRecords: BaseGlyphRecord[];
|
|
10
|
+
layerRecords: LayerRecord[];
|
|
11
|
+
baseGlyphPaintRecords?: BaseGlyphPaintRecord[];
|
|
12
|
+
layerList?: Paint[];
|
|
13
|
+
clipList?: ClipRecord[];
|
|
14
|
+
varIdxMap?: number[];
|
|
15
|
+
itemVariationStore?: ItemVariationStore;
|
|
16
|
+
}
|
|
17
|
+
export interface BaseGlyphRecord {
|
|
18
|
+
glyphId: GlyphId;
|
|
19
|
+
firstLayerIndex: number;
|
|
20
|
+
numLayers: number;
|
|
21
|
+
}
|
|
22
|
+
export interface LayerRecord {
|
|
23
|
+
glyphId: GlyphId;
|
|
24
|
+
paletteIndex: number;
|
|
25
|
+
}
|
|
26
|
+
export interface BaseGlyphPaintRecord {
|
|
27
|
+
glyphId: GlyphId;
|
|
28
|
+
paint: Paint;
|
|
29
|
+
}
|
|
30
|
+
export declare enum PaintFormat {
|
|
31
|
+
ColrLayers = 1,
|
|
32
|
+
Solid = 2,
|
|
33
|
+
VarSolid = 3,
|
|
34
|
+
LinearGradient = 4,
|
|
35
|
+
VarLinearGradient = 5,
|
|
36
|
+
RadialGradient = 6,
|
|
37
|
+
VarRadialGradient = 7,
|
|
38
|
+
SweepGradient = 8,
|
|
39
|
+
VarSweepGradient = 9,
|
|
40
|
+
Glyph = 10,
|
|
41
|
+
ColrGlyph = 11,
|
|
42
|
+
Transform = 12,
|
|
43
|
+
VarTransform = 13,
|
|
44
|
+
Translate = 14,
|
|
45
|
+
VarTranslate = 15,
|
|
46
|
+
Scale = 16,
|
|
47
|
+
VarScale = 17,
|
|
48
|
+
ScaleAroundCenter = 18,
|
|
49
|
+
VarScaleAroundCenter = 19,
|
|
50
|
+
ScaleUniform = 20,
|
|
51
|
+
VarScaleUniform = 21,
|
|
52
|
+
ScaleUniformAroundCenter = 22,
|
|
53
|
+
VarScaleUniformAroundCenter = 23,
|
|
54
|
+
Rotate = 24,
|
|
55
|
+
VarRotate = 25,
|
|
56
|
+
RotateAroundCenter = 26,
|
|
57
|
+
VarRotateAroundCenter = 27,
|
|
58
|
+
Skew = 28,
|
|
59
|
+
VarSkew = 29,
|
|
60
|
+
SkewAroundCenter = 30,
|
|
61
|
+
VarSkewAroundCenter = 31,
|
|
62
|
+
Composite = 32
|
|
63
|
+
}
|
|
64
|
+
export type Paint = PaintColrLayers | PaintSolid | PaintLinearGradient | PaintRadialGradient | PaintSweepGradient | PaintGlyph | PaintColrGlyph | PaintTransform | PaintTranslate | PaintScale | PaintRotate | PaintSkew | PaintComposite;
|
|
65
|
+
export interface PaintColrLayers {
|
|
66
|
+
format: PaintFormat.ColrLayers;
|
|
67
|
+
numLayers: number;
|
|
68
|
+
firstLayerIndex: number;
|
|
69
|
+
}
|
|
70
|
+
export interface PaintSolid {
|
|
71
|
+
format: PaintFormat.Solid | PaintFormat.VarSolid;
|
|
72
|
+
paletteIndex: number;
|
|
73
|
+
alpha: number;
|
|
74
|
+
varIndexBase?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface PaintLinearGradient {
|
|
77
|
+
format: PaintFormat.LinearGradient | PaintFormat.VarLinearGradient;
|
|
78
|
+
colorLine: ColorLine;
|
|
79
|
+
x0: number;
|
|
80
|
+
y0: number;
|
|
81
|
+
x1: number;
|
|
82
|
+
y1: number;
|
|
83
|
+
x2: number;
|
|
84
|
+
y2: number;
|
|
85
|
+
}
|
|
86
|
+
export interface PaintRadialGradient {
|
|
87
|
+
format: PaintFormat.RadialGradient | PaintFormat.VarRadialGradient;
|
|
88
|
+
colorLine: ColorLine;
|
|
89
|
+
x0: number;
|
|
90
|
+
y0: number;
|
|
91
|
+
radius0: number;
|
|
92
|
+
x1: number;
|
|
93
|
+
y1: number;
|
|
94
|
+
radius1: number;
|
|
95
|
+
}
|
|
96
|
+
export interface PaintSweepGradient {
|
|
97
|
+
format: PaintFormat.SweepGradient | PaintFormat.VarSweepGradient;
|
|
98
|
+
colorLine: ColorLine;
|
|
99
|
+
centerX: number;
|
|
100
|
+
centerY: number;
|
|
101
|
+
startAngle: number;
|
|
102
|
+
endAngle: number;
|
|
103
|
+
}
|
|
104
|
+
export interface PaintGlyph {
|
|
105
|
+
format: PaintFormat.Glyph;
|
|
106
|
+
paint: Paint;
|
|
107
|
+
glyphId: GlyphId;
|
|
108
|
+
}
|
|
109
|
+
export interface PaintColrGlyph {
|
|
110
|
+
format: PaintFormat.ColrGlyph;
|
|
111
|
+
glyphId: GlyphId;
|
|
112
|
+
}
|
|
113
|
+
export interface PaintTransform {
|
|
114
|
+
format: PaintFormat.Transform | PaintFormat.VarTransform;
|
|
115
|
+
paint: Paint;
|
|
116
|
+
transform: Affine2x3;
|
|
117
|
+
}
|
|
118
|
+
export interface PaintTranslate {
|
|
119
|
+
format: PaintFormat.Translate | PaintFormat.VarTranslate;
|
|
120
|
+
paint: Paint;
|
|
121
|
+
dx: number;
|
|
122
|
+
dy: number;
|
|
123
|
+
}
|
|
124
|
+
export interface PaintScale {
|
|
125
|
+
format: PaintFormat.Scale | PaintFormat.VarScale | PaintFormat.ScaleAroundCenter | PaintFormat.VarScaleAroundCenter | PaintFormat.ScaleUniform | PaintFormat.VarScaleUniform | PaintFormat.ScaleUniformAroundCenter | PaintFormat.VarScaleUniformAroundCenter;
|
|
126
|
+
paint: Paint;
|
|
127
|
+
scaleX: number;
|
|
128
|
+
scaleY: number;
|
|
129
|
+
centerX?: number;
|
|
130
|
+
centerY?: number;
|
|
131
|
+
}
|
|
132
|
+
export interface PaintRotate {
|
|
133
|
+
format: PaintFormat.Rotate | PaintFormat.VarRotate | PaintFormat.RotateAroundCenter | PaintFormat.VarRotateAroundCenter;
|
|
134
|
+
paint: Paint;
|
|
135
|
+
angle: number;
|
|
136
|
+
centerX?: number;
|
|
137
|
+
centerY?: number;
|
|
138
|
+
}
|
|
139
|
+
export interface PaintSkew {
|
|
140
|
+
format: PaintFormat.Skew | PaintFormat.VarSkew | PaintFormat.SkewAroundCenter | PaintFormat.VarSkewAroundCenter;
|
|
141
|
+
paint: Paint;
|
|
142
|
+
xSkewAngle: number;
|
|
143
|
+
ySkewAngle: number;
|
|
144
|
+
centerX?: number;
|
|
145
|
+
centerY?: number;
|
|
146
|
+
}
|
|
147
|
+
export interface PaintComposite {
|
|
148
|
+
format: PaintFormat.Composite;
|
|
149
|
+
sourcePaint: Paint;
|
|
150
|
+
compositeMode: CompositeMode;
|
|
151
|
+
backdropPaint: Paint;
|
|
152
|
+
}
|
|
153
|
+
export interface ColorLine {
|
|
154
|
+
extend: Extend;
|
|
155
|
+
colorStops: ColorStop[];
|
|
156
|
+
}
|
|
157
|
+
export interface ColorStop {
|
|
158
|
+
stopOffset: number;
|
|
159
|
+
paletteIndex: number;
|
|
160
|
+
alpha: number;
|
|
161
|
+
}
|
|
162
|
+
export declare enum Extend {
|
|
163
|
+
Pad = 0,
|
|
164
|
+
Repeat = 1,
|
|
165
|
+
Reflect = 2
|
|
166
|
+
}
|
|
167
|
+
export declare enum CompositeMode {
|
|
168
|
+
Clear = 0,
|
|
169
|
+
Src = 1,
|
|
170
|
+
Dest = 2,
|
|
171
|
+
SrcOver = 3,
|
|
172
|
+
DestOver = 4,
|
|
173
|
+
SrcIn = 5,
|
|
174
|
+
DestIn = 6,
|
|
175
|
+
SrcOut = 7,
|
|
176
|
+
DestOut = 8,
|
|
177
|
+
SrcAtop = 9,
|
|
178
|
+
DestAtop = 10,
|
|
179
|
+
Xor = 11,
|
|
180
|
+
Plus = 12,
|
|
181
|
+
Screen = 13,
|
|
182
|
+
Overlay = 14,
|
|
183
|
+
Darken = 15,
|
|
184
|
+
Lighten = 16,
|
|
185
|
+
ColorDodge = 17,
|
|
186
|
+
ColorBurn = 18,
|
|
187
|
+
HardLight = 19,
|
|
188
|
+
SoftLight = 20,
|
|
189
|
+
Difference = 21,
|
|
190
|
+
Exclusion = 22,
|
|
191
|
+
Multiply = 23,
|
|
192
|
+
Hue = 24,
|
|
193
|
+
Saturation = 25,
|
|
194
|
+
Color = 26,
|
|
195
|
+
Luminosity = 27
|
|
196
|
+
}
|
|
197
|
+
export interface Affine2x3 {
|
|
198
|
+
xx: number;
|
|
199
|
+
yx: number;
|
|
200
|
+
xy: number;
|
|
201
|
+
yy: number;
|
|
202
|
+
dx: number;
|
|
203
|
+
dy: number;
|
|
204
|
+
}
|
|
205
|
+
export interface ClipRecord {
|
|
206
|
+
startGlyphId: GlyphId;
|
|
207
|
+
endGlyphId: GlyphId;
|
|
208
|
+
clipBox: ClipBox;
|
|
209
|
+
}
|
|
210
|
+
export interface ClipBox {
|
|
211
|
+
format: number;
|
|
212
|
+
xMin: number;
|
|
213
|
+
yMin: number;
|
|
214
|
+
xMax: number;
|
|
215
|
+
yMax: number;
|
|
216
|
+
varIndexBase?: number;
|
|
217
|
+
}
|
|
218
|
+
export interface ItemVariationStore {
|
|
219
|
+
format: number;
|
|
220
|
+
variationRegionListOffset: number;
|
|
221
|
+
itemVariationDataCount: number;
|
|
222
|
+
itemVariationDataOffsets: number[];
|
|
223
|
+
variationRegions: VariationRegion[];
|
|
224
|
+
itemVariationData: ItemVariationData[];
|
|
225
|
+
}
|
|
226
|
+
export interface VariationRegion {
|
|
227
|
+
regionAxes: RegionAxisCoordinates[];
|
|
228
|
+
}
|
|
229
|
+
export interface RegionAxisCoordinates {
|
|
230
|
+
startCoord: number;
|
|
231
|
+
peakCoord: number;
|
|
232
|
+
endCoord: number;
|
|
233
|
+
}
|
|
234
|
+
export interface ItemVariationData {
|
|
235
|
+
itemCount: number;
|
|
236
|
+
wordDeltaCount: number;
|
|
237
|
+
regionIndexCount: number;
|
|
238
|
+
regionIndexes: number[];
|
|
239
|
+
deltaSets: number[][];
|
|
240
|
+
}
|
|
241
|
+
export interface VarColorLine extends ColorLine {
|
|
242
|
+
varIndexBase?: number;
|
|
243
|
+
}
|
|
244
|
+
export interface VarColorStop extends ColorStop {
|
|
245
|
+
varIndexBase?: number;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Parse COLR table
|
|
249
|
+
*/
|
|
250
|
+
export declare function parseColr(reader: Reader): ColrTable;
|
|
251
|
+
/**
|
|
252
|
+
* Get color layers for a glyph (v0)
|
|
253
|
+
*/
|
|
254
|
+
export declare function getColorLayers(colr: ColrTable, glyphId: GlyphId): LayerRecord[] | null;
|
|
255
|
+
/**
|
|
256
|
+
* Get paint for a glyph (v1)
|
|
257
|
+
*/
|
|
258
|
+
export declare function getColorPaint(colr: ColrTable, glyphId: GlyphId): Paint | null;
|
|
259
|
+
/**
|
|
260
|
+
* Check if glyph has color data
|
|
261
|
+
*/
|
|
262
|
+
export declare function hasColorGlyph(colr: ColrTable, glyphId: GlyphId): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Get clip box for a glyph
|
|
265
|
+
*/
|
|
266
|
+
export declare function getClipBox(colr: ColrTable, glyphId: GlyphId): ClipBox | null;
|
|
267
|
+
/**
|
|
268
|
+
* Calculate variation delta for a paint value
|
|
269
|
+
*/
|
|
270
|
+
export declare function getColorVariationDelta(colr: ColrTable, varIndex: number, coords: number[]): number;
|
|
271
|
+
/**
|
|
272
|
+
* Check if COLR table is version 1
|
|
273
|
+
*/
|
|
274
|
+
export declare function isColrV1(colr: ColrTable): boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Get the paint layer at a specific index from the layer list
|
|
277
|
+
*/
|
|
278
|
+
export declare function getLayerPaint(colr: ColrTable, index: number): Paint | null;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Reader } from "../binary/reader.ts";
|
|
2
|
+
/**
|
|
3
|
+
* CPAL (Color Palette) table parser
|
|
4
|
+
* Provides color palettes for color fonts
|
|
5
|
+
*/
|
|
6
|
+
export interface CpalTable {
|
|
7
|
+
version: number;
|
|
8
|
+
numPalettes: number;
|
|
9
|
+
numPaletteEntries: number;
|
|
10
|
+
palettes: ColorPalette[];
|
|
11
|
+
paletteTypes?: number[];
|
|
12
|
+
paletteLabels?: number[];
|
|
13
|
+
paletteEntryLabels?: number[];
|
|
14
|
+
}
|
|
15
|
+
export interface ColorPalette {
|
|
16
|
+
colors: Color[];
|
|
17
|
+
}
|
|
18
|
+
export interface Color {
|
|
19
|
+
blue: number;
|
|
20
|
+
green: number;
|
|
21
|
+
red: number;
|
|
22
|
+
alpha: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Palette type flags
|
|
26
|
+
*/
|
|
27
|
+
export declare enum PaletteType {
|
|
28
|
+
UsableWithLightBackground = 1,
|
|
29
|
+
UsableWithDarkBackground = 2
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parse CPAL table
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseCpal(reader: Reader): CpalTable;
|
|
35
|
+
/**
|
|
36
|
+
* Get color from palette
|
|
37
|
+
*/
|
|
38
|
+
export declare function getColor(cpal: CpalTable, paletteIndex: number, colorIndex: number): Color | null;
|
|
39
|
+
/**
|
|
40
|
+
* Convert color to CSS rgba string
|
|
41
|
+
*/
|
|
42
|
+
export declare function colorToRgba(color: Color): string;
|
|
43
|
+
/**
|
|
44
|
+
* Convert color to CSS hex string
|
|
45
|
+
*/
|
|
46
|
+
export declare function colorToHex(color: Color): string;
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import type { uint16, uint32 } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* AAT Feature Name table (feat)
|
|
5
|
+
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html
|
|
6
|
+
*
|
|
7
|
+
* Defines the font's typographic features that can be controlled by the user.
|
|
8
|
+
* Each feature has a type and settings with human-readable names.
|
|
9
|
+
*/
|
|
10
|
+
export interface FeatTable {
|
|
11
|
+
version: number;
|
|
12
|
+
features: FeatureRecord[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A single feature record
|
|
16
|
+
*/
|
|
17
|
+
export interface FeatureRecord {
|
|
18
|
+
/** Feature type (e.g., 1 = ligatures, 2 = cursive connection) */
|
|
19
|
+
featureType: uint16;
|
|
20
|
+
/** Number of settings for this feature */
|
|
21
|
+
nSettings: uint16;
|
|
22
|
+
/** Offset to setting name array */
|
|
23
|
+
settingTableOffset: uint32;
|
|
24
|
+
/** Feature flags */
|
|
25
|
+
featureFlags: uint16;
|
|
26
|
+
/** Default setting index */
|
|
27
|
+
defaultSettingIndex: uint16;
|
|
28
|
+
/** Name table ID for feature name */
|
|
29
|
+
nameId: uint16;
|
|
30
|
+
/** Parsed settings */
|
|
31
|
+
settings: FeatureSetting[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A single feature setting
|
|
35
|
+
*/
|
|
36
|
+
export interface FeatureSetting {
|
|
37
|
+
/** Setting value to use in morx feature table */
|
|
38
|
+
settingValue: uint16;
|
|
39
|
+
/** Name table ID for setting name */
|
|
40
|
+
nameId: uint16;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Feature type constants (Apple-defined)
|
|
44
|
+
*/
|
|
45
|
+
export declare enum FeatureType {
|
|
46
|
+
/** All typographic features */
|
|
47
|
+
AllTypographicFeatures = 0,
|
|
48
|
+
/** Ligatures */
|
|
49
|
+
Ligatures = 1,
|
|
50
|
+
/** Cursive connection */
|
|
51
|
+
CursiveConnection = 2,
|
|
52
|
+
/** Letter case */
|
|
53
|
+
LetterCase = 3,
|
|
54
|
+
/** Vertical substitution */
|
|
55
|
+
VerticalSubstitution = 4,
|
|
56
|
+
/** Linguistic rearrangement */
|
|
57
|
+
LinguisticRearrangement = 5,
|
|
58
|
+
/** Number spacing */
|
|
59
|
+
NumberSpacing = 6,
|
|
60
|
+
/** Smart swashes */
|
|
61
|
+
SmartSwashes = 8,
|
|
62
|
+
/** Diacritics */
|
|
63
|
+
Diacritics = 9,
|
|
64
|
+
/** Vertical position */
|
|
65
|
+
VerticalPosition = 10,
|
|
66
|
+
/** Fractions */
|
|
67
|
+
Fractions = 11,
|
|
68
|
+
/** Overlapping characters */
|
|
69
|
+
OverlappingCharacters = 13,
|
|
70
|
+
/** Typographic extras */
|
|
71
|
+
TypographicExtras = 14,
|
|
72
|
+
/** Mathematical extras */
|
|
73
|
+
MathematicalExtras = 15,
|
|
74
|
+
/** Ornament sets */
|
|
75
|
+
OrnamentSets = 16,
|
|
76
|
+
/** Character alternatives */
|
|
77
|
+
CharacterAlternatives = 17,
|
|
78
|
+
/** Design complexity */
|
|
79
|
+
DesignComplexity = 18,
|
|
80
|
+
/** Style options */
|
|
81
|
+
StyleOptions = 19,
|
|
82
|
+
/** Character shape */
|
|
83
|
+
CharacterShape = 20,
|
|
84
|
+
/** Number case */
|
|
85
|
+
NumberCase = 21,
|
|
86
|
+
/** Text spacing */
|
|
87
|
+
TextSpacing = 22,
|
|
88
|
+
/** Transliteration */
|
|
89
|
+
Transliteration = 23,
|
|
90
|
+
/** Annotation */
|
|
91
|
+
Annotation = 24,
|
|
92
|
+
/** Kana spacing */
|
|
93
|
+
KanaSpacing = 25,
|
|
94
|
+
/** Ideographic spacing */
|
|
95
|
+
IdeographicSpacing = 26,
|
|
96
|
+
/** Unicode decomposition */
|
|
97
|
+
UnicodeDecomposition = 27,
|
|
98
|
+
/** Ruby kana */
|
|
99
|
+
RubyKana = 28,
|
|
100
|
+
/** CJK symbol alternatives */
|
|
101
|
+
CJKSymbolAlternatives = 29,
|
|
102
|
+
/** Ideographic alternatives */
|
|
103
|
+
IdeographicAlternatives = 30,
|
|
104
|
+
/** CJK vertical roman placement */
|
|
105
|
+
CJKVerticalRomanPlacement = 31,
|
|
106
|
+
/** Italic CJK roman */
|
|
107
|
+
ItalicCJKRoman = 32,
|
|
108
|
+
/** Case-sensitive layout */
|
|
109
|
+
CaseSensitiveLayout = 33,
|
|
110
|
+
/** Alternate kana */
|
|
111
|
+
AlternateKana = 34,
|
|
112
|
+
/** Stylistic alternatives */
|
|
113
|
+
StylisticAlternatives = 35,
|
|
114
|
+
/** Contextual alternatives */
|
|
115
|
+
ContextualAlternatives = 36,
|
|
116
|
+
/** Lower case */
|
|
117
|
+
LowerCase = 37,
|
|
118
|
+
/** Upper case */
|
|
119
|
+
UpperCase = 38,
|
|
120
|
+
/** Language tag */
|
|
121
|
+
LanguageTag = 39,
|
|
122
|
+
/** CJK roman spacing */
|
|
123
|
+
CJKRomanSpacing = 103
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Common ligature settings
|
|
127
|
+
*/
|
|
128
|
+
export declare enum LigatureSetting {
|
|
129
|
+
RequiredLigaturesOn = 0,
|
|
130
|
+
RequiredLigaturesOff = 1,
|
|
131
|
+
CommonLigaturesOn = 2,
|
|
132
|
+
CommonLigaturesOff = 3,
|
|
133
|
+
RareLigaturesOn = 4,
|
|
134
|
+
RareLigaturesOff = 5,
|
|
135
|
+
LogosOn = 6,
|
|
136
|
+
LogosOff = 7,
|
|
137
|
+
RebusPicturesOn = 8,
|
|
138
|
+
RebusPicturesOff = 9,
|
|
139
|
+
DiphthongLigaturesOn = 10,
|
|
140
|
+
DiphthongLigaturesOff = 11,
|
|
141
|
+
SquaredLigaturesOn = 12,
|
|
142
|
+
SquaredLigaturesOff = 13,
|
|
143
|
+
AbbrevSquaredLigaturesOn = 14,
|
|
144
|
+
AbbrevSquaredLigaturesOff = 15,
|
|
145
|
+
SymbolLigaturesOn = 16,
|
|
146
|
+
SymbolLigaturesOff = 17,
|
|
147
|
+
ContextualLigaturesOn = 18,
|
|
148
|
+
ContextualLigaturesOff = 19,
|
|
149
|
+
HistoricalLigaturesOn = 20,
|
|
150
|
+
HistoricalLigaturesOff = 21
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Vertical position settings
|
|
154
|
+
*/
|
|
155
|
+
export declare enum VerticalPositionSetting {
|
|
156
|
+
NormalPosition = 0,
|
|
157
|
+
Superiors = 1,
|
|
158
|
+
Inferiors = 2,
|
|
159
|
+
Ordinals = 3,
|
|
160
|
+
ScientificInferiors = 4
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Number case settings
|
|
164
|
+
*/
|
|
165
|
+
export declare enum NumberCaseSetting {
|
|
166
|
+
LowerCaseNumbers = 0,
|
|
167
|
+
UpperCaseNumbers = 1
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Number spacing settings
|
|
171
|
+
*/
|
|
172
|
+
export declare enum NumberSpacingSetting {
|
|
173
|
+
MonospacedNumbers = 0,
|
|
174
|
+
ProportionalNumbers = 1,
|
|
175
|
+
ThirdWidthNumbers = 2,
|
|
176
|
+
QuarterWidthNumbers = 3
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Fractions settings
|
|
180
|
+
*/
|
|
181
|
+
export declare enum FractionsSetting {
|
|
182
|
+
NoFractions = 0,
|
|
183
|
+
VerticalFractions = 1,
|
|
184
|
+
DiagonalFractions = 2
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Case-sensitive layout settings
|
|
188
|
+
*/
|
|
189
|
+
export declare enum CaseSensitiveLayoutSetting {
|
|
190
|
+
CaseSensitiveLayoutOn = 0,
|
|
191
|
+
CaseSensitiveLayoutOff = 1,
|
|
192
|
+
CaseSensitiveSpacingOn = 2,
|
|
193
|
+
CaseSensitiveSpacingOff = 3
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Stylistic alternatives settings
|
|
197
|
+
*/
|
|
198
|
+
export declare enum StylisticAlternativesSetting {
|
|
199
|
+
NoStylisticAlternates = 0,
|
|
200
|
+
StylisticAltOneOn = 2,
|
|
201
|
+
StylisticAltOneOff = 3,
|
|
202
|
+
StylisticAltTwoOn = 4,
|
|
203
|
+
StylisticAltTwoOff = 5,
|
|
204
|
+
StylisticAltThreeOn = 6,
|
|
205
|
+
StylisticAltThreeOff = 7,
|
|
206
|
+
StylisticAltFourOn = 8,
|
|
207
|
+
StylisticAltFourOff = 9,
|
|
208
|
+
StylisticAltFiveOn = 10,
|
|
209
|
+
StylisticAltFiveOff = 11,
|
|
210
|
+
StylisticAltSixOn = 12,
|
|
211
|
+
StylisticAltSixOff = 13,
|
|
212
|
+
StylisticAltSevenOn = 14,
|
|
213
|
+
StylisticAltSevenOff = 15,
|
|
214
|
+
StylisticAltEightOn = 16,
|
|
215
|
+
StylisticAltEightOff = 17,
|
|
216
|
+
StylisticAltNineOn = 18,
|
|
217
|
+
StylisticAltNineOff = 19,
|
|
218
|
+
StylisticAltTenOn = 20,
|
|
219
|
+
StylisticAltTenOff = 21,
|
|
220
|
+
StylisticAltElevenOn = 22,
|
|
221
|
+
StylisticAltElevenOff = 23,
|
|
222
|
+
StylisticAltTwelveOn = 24,
|
|
223
|
+
StylisticAltTwelveOff = 25,
|
|
224
|
+
StylisticAltThirteenOn = 26,
|
|
225
|
+
StylisticAltThirteenOff = 27,
|
|
226
|
+
StylisticAltFourteenOn = 28,
|
|
227
|
+
StylisticAltFourteenOff = 29,
|
|
228
|
+
StylisticAltFifteenOn = 30,
|
|
229
|
+
StylisticAltFifteenOff = 31,
|
|
230
|
+
StylisticAltSixteenOn = 32,
|
|
231
|
+
StylisticAltSixteenOff = 33,
|
|
232
|
+
StylisticAltSeventeenOn = 34,
|
|
233
|
+
StylisticAltSeventeenOff = 35,
|
|
234
|
+
StylisticAltEighteenOn = 36,
|
|
235
|
+
StylisticAltEighteenOff = 37,
|
|
236
|
+
StylisticAltNineteenOn = 38,
|
|
237
|
+
StylisticAltNineteenOff = 39,
|
|
238
|
+
StylisticAltTwentyOn = 40,
|
|
239
|
+
StylisticAltTwentyOff = 41
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Contextual alternatives settings
|
|
243
|
+
*/
|
|
244
|
+
export declare enum ContextualAlternativesSetting {
|
|
245
|
+
ContextualAlternatesOn = 0,
|
|
246
|
+
ContextualAlternatesOff = 1,
|
|
247
|
+
SwashAlternatesOn = 2,
|
|
248
|
+
SwashAlternatesOff = 3,
|
|
249
|
+
ContextualSwashAlternatesOn = 4,
|
|
250
|
+
ContextualSwashAlternatesOff = 5
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Lower case settings
|
|
254
|
+
*/
|
|
255
|
+
export declare enum LowerCaseSetting {
|
|
256
|
+
DefaultLowerCase = 0,
|
|
257
|
+
LowerCaseSmallCaps = 1,
|
|
258
|
+
LowerCasePetiteCaps = 2
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Upper case settings
|
|
262
|
+
*/
|
|
263
|
+
export declare enum UpperCaseSetting {
|
|
264
|
+
DefaultUpperCase = 0,
|
|
265
|
+
UpperCaseSmallCaps = 1,
|
|
266
|
+
UpperCasePetiteCaps = 2
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Smart swash settings
|
|
270
|
+
*/
|
|
271
|
+
export declare enum SmartSwashSetting {
|
|
272
|
+
WordInitialSwashesOn = 0,
|
|
273
|
+
WordInitialSwashesOff = 1,
|
|
274
|
+
WordFinalSwashesOn = 2,
|
|
275
|
+
WordFinalSwashesOff = 3,
|
|
276
|
+
LineInitialSwashesOn = 4,
|
|
277
|
+
LineInitialSwashesOff = 5,
|
|
278
|
+
LineFinalSwashesOn = 6,
|
|
279
|
+
LineFinalSwashesOff = 7,
|
|
280
|
+
NonFinalSwashesOn = 8,
|
|
281
|
+
NonFinalSwashesOff = 9
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Diacritics settings
|
|
285
|
+
*/
|
|
286
|
+
export declare enum DiacriticsSetting {
|
|
287
|
+
ShowDiacritics = 0,
|
|
288
|
+
HideDiacritics = 1,
|
|
289
|
+
DecomposeDiacritics = 2
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Character shape settings (CJK)
|
|
293
|
+
*/
|
|
294
|
+
export declare enum CharacterShapeSetting {
|
|
295
|
+
TraditionalCharacters = 0,
|
|
296
|
+
SimplifiedCharacters = 1,
|
|
297
|
+
JIS1978Characters = 2,
|
|
298
|
+
JIS1983Characters = 3,
|
|
299
|
+
JIS1990Characters = 4,
|
|
300
|
+
TraditionalAltOne = 5,
|
|
301
|
+
TraditionalAltTwo = 6,
|
|
302
|
+
TraditionalAltThree = 7,
|
|
303
|
+
TraditionalAltFour = 8,
|
|
304
|
+
TraditionalAltFive = 9,
|
|
305
|
+
ExpertCharacters = 10,
|
|
306
|
+
NLCCharacters = 13,
|
|
307
|
+
JIS2004Characters = 11,
|
|
308
|
+
HojoCharacters = 12
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Feature flag bits
|
|
312
|
+
*/
|
|
313
|
+
export declare enum FeatureFlags {
|
|
314
|
+
/** Feature settings are mutually exclusive */
|
|
315
|
+
Exclusive = 32768,
|
|
316
|
+
/** Use default setting index if not specified */
|
|
317
|
+
UseDefault = 16384
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Parse feat table
|
|
321
|
+
*/
|
|
322
|
+
export declare function parseFeat(reader: Reader): FeatTable;
|
|
323
|
+
/**
|
|
324
|
+
* Get a feature by type
|
|
325
|
+
*/
|
|
326
|
+
export declare function getFeature(table: FeatTable, featureType: FeatureType | uint16): FeatureRecord | undefined;
|
|
327
|
+
/**
|
|
328
|
+
* Get all features of a given type
|
|
329
|
+
*/
|
|
330
|
+
export declare function getAllFeatures(table: FeatTable): FeatureRecord[];
|
|
331
|
+
/**
|
|
332
|
+
* Check if a feature is exclusive (only one setting can be active)
|
|
333
|
+
*/
|
|
334
|
+
export declare function isExclusiveFeature(feature: FeatureRecord): boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Get the default setting for a feature
|
|
337
|
+
*/
|
|
338
|
+
export declare function getDefaultSetting(feature: FeatureRecord): FeatureSetting | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* Get a setting by value
|
|
341
|
+
*/
|
|
342
|
+
export declare function getSettingByValue(feature: FeatureRecord, settingValue: uint16): FeatureSetting | undefined;
|
|
343
|
+
/**
|
|
344
|
+
* Check if a feature has a specific setting
|
|
345
|
+
*/
|
|
346
|
+
export declare function hasSettingValue(feature: FeatureRecord, settingValue: uint16): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Convert AAT feature type/setting to OpenType feature tag
|
|
349
|
+
* This is a best-effort mapping as there's no 1:1 correspondence
|
|
350
|
+
*/
|
|
351
|
+
export declare function aatToOpenTypeTag(featureType: FeatureType | uint16, settingValue: uint16): string | null;
|
|
352
|
+
/**
|
|
353
|
+
* Convert OpenType feature tag to AAT feature type/setting
|
|
354
|
+
* Returns null if no mapping exists
|
|
355
|
+
*/
|
|
356
|
+
export declare function openTypeTagToAat(tag: string): {
|
|
357
|
+
featureType: FeatureType;
|
|
358
|
+
settingValue: uint16;
|
|
359
|
+
} | null;
|