text-shaper 0.0.1 → 0.1.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 +6 -1
- package/README.md +27 -1
- package/dist/font/brotli/context.d.ts +6 -0
- package/dist/font/brotli/decode.d.ts +9 -0
- package/dist/font/brotli/dictionary.d.ts +11 -0
- package/dist/font/brotli/transform.d.ts +12 -0
- package/dist/font/font.d.ts +19 -5
- package/dist/font/tables/cff.d.ts +4 -0
- package/dist/font/tables/gasp.d.ts +54 -0
- package/dist/font/tables/gdef.d.ts +3 -0
- package/dist/font/tables/glyf.d.ts +2 -0
- package/dist/font/tables/hinting.d.ts +38 -0
- package/dist/font/woff2.d.ts +8 -0
- package/dist/hinting/index.d.ts +9 -0
- package/dist/hinting/instructions/arithmetic.d.ts +46 -0
- package/dist/hinting/instructions/control-flow.d.ts +26 -0
- package/dist/hinting/instructions/delta.d.ts +32 -0
- package/dist/hinting/instructions/graphics-state.d.ts +94 -0
- package/dist/hinting/instructions/interpolate.d.ts +16 -0
- package/dist/hinting/instructions/points.d.ts +76 -0
- package/dist/hinting/instructions/stack.d.ts +28 -0
- package/dist/hinting/interpreter.d.ts +30 -0
- package/dist/hinting/programs.d.ts +88 -0
- package/dist/hinting/rounding.d.ts +51 -0
- package/dist/hinting/types.d.ts +369 -0
- package/dist/index.d.ts +21 -11
- package/dist/index.js +10 -8
- package/dist/index.js.map +60 -29
- package/dist/raster/atlas.d.ts +37 -0
- package/dist/raster/bbox.d.ts +91 -0
- package/dist/raster/bitmap-utils.d.ts +25 -0
- package/dist/raster/blur.d.ts +27 -0
- package/dist/raster/cell.d.ts +140 -0
- package/dist/raster/fixed-point.d.ts +100 -0
- package/dist/raster/gradient.d.ts +61 -0
- package/dist/raster/gray-raster.d.ts +132 -0
- package/dist/raster/lcd-filter.d.ts +44 -0
- package/dist/raster/outline-decompose.d.ts +61 -0
- package/dist/raster/rasterize.d.ts +43 -0
- package/dist/raster/sdf.d.ts +37 -0
- package/dist/raster/stroker.d.ts +29 -0
- package/dist/raster/synth.d.ts +50 -0
- package/dist/raster/types.d.ts +176 -0
- package/dist/render/path.d.ts +50 -2
- package/dist/shaper/complex/indic.d.ts +4 -0
- package/dist/types.d.ts +4 -0
- package/dist/unicode/bidi/brackets.gen.d.ts +5 -0
- package/dist/unicode/bidi/char-types.gen.d.ts +25 -0
- package/dist/unicode/bidi/mirroring.gen.d.ts +2 -0
- package/package.json +41 -14
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TrueType Bytecode Interpreter
|
|
3
|
+
*
|
|
4
|
+
* Main dispatch loop for executing TrueType hinting instructions.
|
|
5
|
+
*/
|
|
6
|
+
import { CodeRange, type ExecContext } from "./types.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Execute bytecode from the current instruction pointer
|
|
9
|
+
*/
|
|
10
|
+
export declare function execute(ctx: ExecContext): void;
|
|
11
|
+
/**
|
|
12
|
+
* Set up execution context with code range
|
|
13
|
+
*/
|
|
14
|
+
export declare function setCodeRange(ctx: ExecContext, range: CodeRange, code: Uint8Array): void;
|
|
15
|
+
/**
|
|
16
|
+
* Run code in a specific range
|
|
17
|
+
*/
|
|
18
|
+
export declare function runProgram(ctx: ExecContext, range: CodeRange): void;
|
|
19
|
+
/**
|
|
20
|
+
* Run the font program (fpgm table)
|
|
21
|
+
*/
|
|
22
|
+
export declare function runFontProgram(ctx: ExecContext): void;
|
|
23
|
+
/**
|
|
24
|
+
* Run the CVT program (prep table)
|
|
25
|
+
*/
|
|
26
|
+
export declare function runCVTProgram(ctx: ExecContext): void;
|
|
27
|
+
/**
|
|
28
|
+
* Run glyph instructions
|
|
29
|
+
*/
|
|
30
|
+
export declare function runGlyphProgram(ctx: ExecContext, instructions: Uint8Array): void;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TrueType Hinting Program Execution
|
|
3
|
+
*
|
|
4
|
+
* This module handles the setup and execution of TrueType hinting programs:
|
|
5
|
+
* - fpgm: Font program (executed once when font is loaded)
|
|
6
|
+
* - prep: CVT program (executed when size changes)
|
|
7
|
+
* - glyph: Per-glyph instructions
|
|
8
|
+
*/
|
|
9
|
+
import { type ExecContext } from "./types.ts";
|
|
10
|
+
/**
|
|
11
|
+
* Hinting engine for a font
|
|
12
|
+
*/
|
|
13
|
+
export interface HintingEngine {
|
|
14
|
+
/** Execution context */
|
|
15
|
+
ctx: ExecContext;
|
|
16
|
+
/** Units per EM from font */
|
|
17
|
+
unitsPerEM: number;
|
|
18
|
+
/** Has fpgm been executed */
|
|
19
|
+
fpgmExecuted: boolean;
|
|
20
|
+
/** Current ppem (prep needs re-run if this changes) */
|
|
21
|
+
currentPpem: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a hinting engine for a font
|
|
25
|
+
*/
|
|
26
|
+
export declare function createHintingEngine(unitsPerEM: number, maxStack?: number, maxStorage?: number, maxFDefs?: number, maxTwilightPoints?: number, cvtValues?: Int32Array): HintingEngine;
|
|
27
|
+
/**
|
|
28
|
+
* Load font program (fpgm table)
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadFontProgram(engine: HintingEngine, fpgm: Uint8Array): void;
|
|
31
|
+
/**
|
|
32
|
+
* Load CVT program (prep table)
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadCVTProgram(engine: HintingEngine, prep: Uint8Array): void;
|
|
35
|
+
/**
|
|
36
|
+
* Execute fpgm (should be called once after font load)
|
|
37
|
+
*/
|
|
38
|
+
export declare function executeFontProgram(engine: HintingEngine): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Set up for a specific size and execute prep if needed
|
|
41
|
+
*/
|
|
42
|
+
export declare function setSize(engine: HintingEngine, ppem: number, pointSize: number): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Glyph outline for hinting
|
|
45
|
+
*/
|
|
46
|
+
export interface GlyphOutline {
|
|
47
|
+
/** X coordinates in font units */
|
|
48
|
+
xCoords: number[];
|
|
49
|
+
/** Y coordinates in font units */
|
|
50
|
+
yCoords: number[];
|
|
51
|
+
/** Point flags (bit 0 = on-curve) */
|
|
52
|
+
flags: Uint8Array;
|
|
53
|
+
/** End point indices for each contour */
|
|
54
|
+
contourEnds: number[];
|
|
55
|
+
/** Glyph instructions */
|
|
56
|
+
instructions: Uint8Array;
|
|
57
|
+
/** Left side bearing in font units (for phantom point) */
|
|
58
|
+
lsb?: number;
|
|
59
|
+
/** Advance width in font units (for phantom point) */
|
|
60
|
+
advanceWidth?: number;
|
|
61
|
+
/** Top side bearing in font units (for vertical phantom point) */
|
|
62
|
+
tsb?: number;
|
|
63
|
+
/** Advance height in font units (for vertical phantom point) */
|
|
64
|
+
advanceHeight?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Hinted glyph result
|
|
68
|
+
*/
|
|
69
|
+
export interface HintedGlyph {
|
|
70
|
+
/** Hinted X coordinates in 26.6 pixels */
|
|
71
|
+
xCoords: number[];
|
|
72
|
+
/** Hinted Y coordinates in 26.6 pixels */
|
|
73
|
+
yCoords: number[];
|
|
74
|
+
/** Point flags */
|
|
75
|
+
flags: Uint8Array;
|
|
76
|
+
/** Contour end indices */
|
|
77
|
+
contourEnds: number[];
|
|
78
|
+
/** Error message if hinting failed */
|
|
79
|
+
error: string | null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Hint a glyph
|
|
83
|
+
*/
|
|
84
|
+
export declare function hintGlyph(engine: HintingEngine, outline: GlyphOutline): HintedGlyph;
|
|
85
|
+
/**
|
|
86
|
+
* Convert hinted coordinates from 26.6 to floating point pixels
|
|
87
|
+
*/
|
|
88
|
+
export declare function hintedToPixels(coords: number[]): number[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TrueType rounding functions
|
|
3
|
+
*
|
|
4
|
+
* These implement the various rounding modes used by the interpreter.
|
|
5
|
+
*/
|
|
6
|
+
import { type F26Dot6, type GraphicsState } from "./types.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Round to grid (nearest integer pixel)
|
|
9
|
+
*/
|
|
10
|
+
export declare function roundToGrid(distance: F26Dot6, compensation: F26Dot6): F26Dot6;
|
|
11
|
+
/**
|
|
12
|
+
* Round to half grid (nearest half pixel)
|
|
13
|
+
*/
|
|
14
|
+
export declare function roundToHalfGrid(distance: F26Dot6, compensation: F26Dot6): F26Dot6;
|
|
15
|
+
/**
|
|
16
|
+
* Round to double grid (nearest half pixel boundary)
|
|
17
|
+
*/
|
|
18
|
+
export declare function roundToDoubleGrid(distance: F26Dot6, compensation: F26Dot6): F26Dot6;
|
|
19
|
+
/**
|
|
20
|
+
* Round down to grid (floor to pixel)
|
|
21
|
+
*/
|
|
22
|
+
export declare function roundDownToGrid(distance: F26Dot6, compensation: F26Dot6): F26Dot6;
|
|
23
|
+
/**
|
|
24
|
+
* Round up to grid (ceiling to pixel)
|
|
25
|
+
*/
|
|
26
|
+
export declare function roundUpToGrid(distance: F26Dot6, compensation: F26Dot6): F26Dot6;
|
|
27
|
+
/**
|
|
28
|
+
* No rounding
|
|
29
|
+
*/
|
|
30
|
+
export declare function roundOff(distance: F26Dot6, _compensation: F26Dot6): F26Dot6;
|
|
31
|
+
/**
|
|
32
|
+
* Super rounding (parametric rounding)
|
|
33
|
+
*/
|
|
34
|
+
export declare function roundSuper(distance: F26Dot6, compensation: F26Dot6, GS: GraphicsState): F26Dot6;
|
|
35
|
+
/**
|
|
36
|
+
* Super rounding 45 degrees (for diagonal lines)
|
|
37
|
+
*/
|
|
38
|
+
export declare function roundSuper45(distance: F26Dot6, compensation: F26Dot6, GS: GraphicsState): F26Dot6;
|
|
39
|
+
/**
|
|
40
|
+
* Apply current rounding mode
|
|
41
|
+
*/
|
|
42
|
+
export declare function round(distance: F26Dot6, compensation: F26Dot6, GS: GraphicsState): F26Dot6;
|
|
43
|
+
/**
|
|
44
|
+
* Parse SROUND/S45ROUND selector byte
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseSuperRound(selector: number, GS: GraphicsState): void;
|
|
47
|
+
/**
|
|
48
|
+
* Compensate distance for engine characteristics
|
|
49
|
+
* Used with ROUND and movement instructions
|
|
50
|
+
*/
|
|
51
|
+
export declare function compensate(_distance: F26Dot6, _GS: GraphicsState): F26Dot6;
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TrueType Hinting Types
|
|
3
|
+
*
|
|
4
|
+
* Based on FreeType's ttinterp.h and ttobjs.h
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 26.6 fixed-point number (used for coordinates)
|
|
8
|
+
*/
|
|
9
|
+
export type F26Dot6 = number;
|
|
10
|
+
/**
|
|
11
|
+
* 2.14 fixed-point number (used for unit vectors)
|
|
12
|
+
*/
|
|
13
|
+
export type F2Dot14 = number;
|
|
14
|
+
/**
|
|
15
|
+
* Unit vector in 2.14 format
|
|
16
|
+
*/
|
|
17
|
+
export interface UnitVector {
|
|
18
|
+
x: F2Dot14;
|
|
19
|
+
y: F2Dot14;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Point coordinate
|
|
23
|
+
*/
|
|
24
|
+
export interface Point {
|
|
25
|
+
x: F26Dot6;
|
|
26
|
+
y: F26Dot6;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Rounding mode for ROUND instruction
|
|
30
|
+
*/
|
|
31
|
+
export declare enum RoundMode {
|
|
32
|
+
ToHalfGrid = 0,
|
|
33
|
+
ToGrid = 1,
|
|
34
|
+
ToDoubleGrid = 2,
|
|
35
|
+
DownToGrid = 3,
|
|
36
|
+
UpToGrid = 4,
|
|
37
|
+
Off = 5,
|
|
38
|
+
Super = 6,
|
|
39
|
+
Super45 = 7
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Touch flags for points
|
|
43
|
+
*/
|
|
44
|
+
export declare enum TouchFlag {
|
|
45
|
+
X = 1,
|
|
46
|
+
Y = 2,
|
|
47
|
+
Both = 3
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Glyph zone - holds glyph points
|
|
51
|
+
*/
|
|
52
|
+
export interface GlyphZone {
|
|
53
|
+
/** Number of points */
|
|
54
|
+
nPoints: number;
|
|
55
|
+
/** Number of contours */
|
|
56
|
+
nContours: number;
|
|
57
|
+
/** Original point positions (before hinting) */
|
|
58
|
+
org: Point[];
|
|
59
|
+
/** Current point positions (after hinting) */
|
|
60
|
+
cur: Point[];
|
|
61
|
+
/** Original unscaled positions */
|
|
62
|
+
orus: Point[];
|
|
63
|
+
/** Touch flags per point */
|
|
64
|
+
tags: Uint8Array;
|
|
65
|
+
/** Contour end indices */
|
|
66
|
+
contours: Uint16Array;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* TrueType Graphics State
|
|
70
|
+
*
|
|
71
|
+
* Contains all state variables that control how instructions operate
|
|
72
|
+
*/
|
|
73
|
+
export interface GraphicsState {
|
|
74
|
+
rp0: number;
|
|
75
|
+
rp1: number;
|
|
76
|
+
rp2: number;
|
|
77
|
+
dualVector: UnitVector;
|
|
78
|
+
projVector: UnitVector;
|
|
79
|
+
freeVector: UnitVector;
|
|
80
|
+
loop: number;
|
|
81
|
+
minimumDistance: F26Dot6;
|
|
82
|
+
roundState: RoundMode;
|
|
83
|
+
autoFlip: boolean;
|
|
84
|
+
controlValueCutIn: F26Dot6;
|
|
85
|
+
singleWidthCutIn: F26Dot6;
|
|
86
|
+
singleWidthValue: F26Dot6;
|
|
87
|
+
deltaBase: number;
|
|
88
|
+
deltaShift: number;
|
|
89
|
+
instructControl: number;
|
|
90
|
+
scanControl: number;
|
|
91
|
+
scanType: number;
|
|
92
|
+
gep0: number;
|
|
93
|
+
gep1: number;
|
|
94
|
+
gep2: number;
|
|
95
|
+
period: F26Dot6;
|
|
96
|
+
phase: F26Dot6;
|
|
97
|
+
threshold: F26Dot6;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create default graphics state
|
|
101
|
+
*/
|
|
102
|
+
export declare function createDefaultGraphicsState(): GraphicsState;
|
|
103
|
+
/**
|
|
104
|
+
* Function definition (from FDEF instruction)
|
|
105
|
+
*/
|
|
106
|
+
export interface FunctionDef {
|
|
107
|
+
/** Function number */
|
|
108
|
+
id: number;
|
|
109
|
+
/** Start offset in bytecode */
|
|
110
|
+
start: number;
|
|
111
|
+
/** End offset (just after ENDF) */
|
|
112
|
+
end: number;
|
|
113
|
+
/** Active (has been defined) */
|
|
114
|
+
active: boolean;
|
|
115
|
+
/** Which code range */
|
|
116
|
+
range: CodeRange;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Instruction definition (from IDEF instruction)
|
|
120
|
+
*/
|
|
121
|
+
export interface InstructionDef {
|
|
122
|
+
/** Opcode being redefined */
|
|
123
|
+
opcode: number;
|
|
124
|
+
/** Start offset */
|
|
125
|
+
start: number;
|
|
126
|
+
/** End offset */
|
|
127
|
+
end: number;
|
|
128
|
+
/** Active */
|
|
129
|
+
active: boolean;
|
|
130
|
+
/** Code range */
|
|
131
|
+
range: CodeRange;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Code range type
|
|
135
|
+
*/
|
|
136
|
+
export declare enum CodeRange {
|
|
137
|
+
None = 0,
|
|
138
|
+
Font = 1,// fpgm table
|
|
139
|
+
CVT = 2,// prep table
|
|
140
|
+
Glyph = 3
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Call stack record
|
|
144
|
+
*/
|
|
145
|
+
export interface CallRecord {
|
|
146
|
+
/** Caller's instruction pointer */
|
|
147
|
+
callerIP: number;
|
|
148
|
+
/** Caller's code range */
|
|
149
|
+
callerRange: CodeRange;
|
|
150
|
+
/** Function definition */
|
|
151
|
+
def: FunctionDef;
|
|
152
|
+
/** Loop count (for LOOPCALL) */
|
|
153
|
+
count: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Execution context for the TrueType interpreter
|
|
157
|
+
*/
|
|
158
|
+
export interface ExecContext {
|
|
159
|
+
GS: GraphicsState;
|
|
160
|
+
defaultGS: GraphicsState;
|
|
161
|
+
zp0: GlyphZone;
|
|
162
|
+
zp1: GlyphZone;
|
|
163
|
+
zp2: GlyphZone;
|
|
164
|
+
twilight: GlyphZone;
|
|
165
|
+
pts: GlyphZone;
|
|
166
|
+
stack: Int32Array;
|
|
167
|
+
stackTop: number;
|
|
168
|
+
IP: number;
|
|
169
|
+
code: Uint8Array;
|
|
170
|
+
codeSize: number;
|
|
171
|
+
currentRange: CodeRange;
|
|
172
|
+
opcode: number;
|
|
173
|
+
numArgs: number;
|
|
174
|
+
cvt: Int32Array;
|
|
175
|
+
cvtSize: number;
|
|
176
|
+
storage: Int32Array;
|
|
177
|
+
storageSize: number;
|
|
178
|
+
FDefs: FunctionDef[];
|
|
179
|
+
maxFDefs: number;
|
|
180
|
+
IDefs: InstructionDef[];
|
|
181
|
+
maxIDefs: number;
|
|
182
|
+
callStack: CallRecord[];
|
|
183
|
+
callStackTop: number;
|
|
184
|
+
maxCallStack: number;
|
|
185
|
+
codeRanges: Map<CodeRange, {
|
|
186
|
+
code: Uint8Array;
|
|
187
|
+
size: number;
|
|
188
|
+
}>;
|
|
189
|
+
ppem: number;
|
|
190
|
+
pointSize: number;
|
|
191
|
+
scale: number;
|
|
192
|
+
error: string | null;
|
|
193
|
+
instructionCount: number;
|
|
194
|
+
maxInstructions: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Create an empty glyph zone
|
|
198
|
+
*/
|
|
199
|
+
export declare function createGlyphZone(maxPoints: number, maxContours: number): GlyphZone;
|
|
200
|
+
/**
|
|
201
|
+
* Create execution context
|
|
202
|
+
*/
|
|
203
|
+
export declare function createExecContext(maxStack?: number, maxStorage?: number, maxFDefs?: number, maxIDefs?: number, maxCallStack?: number, maxTwilightPoints?: number): ExecContext;
|
|
204
|
+
/**
|
|
205
|
+
* TrueType Opcodes
|
|
206
|
+
*/
|
|
207
|
+
export declare const Opcode: {
|
|
208
|
+
readonly NPUSHB: 64;
|
|
209
|
+
readonly NPUSHW: 65;
|
|
210
|
+
readonly PUSHB_0: 176;
|
|
211
|
+
readonly PUSHB_1: 177;
|
|
212
|
+
readonly PUSHB_2: 178;
|
|
213
|
+
readonly PUSHB_3: 179;
|
|
214
|
+
readonly PUSHB_4: 180;
|
|
215
|
+
readonly PUSHB_5: 181;
|
|
216
|
+
readonly PUSHB_6: 182;
|
|
217
|
+
readonly PUSHB_7: 183;
|
|
218
|
+
readonly PUSHW_0: 184;
|
|
219
|
+
readonly PUSHW_1: 185;
|
|
220
|
+
readonly PUSHW_2: 186;
|
|
221
|
+
readonly PUSHW_3: 187;
|
|
222
|
+
readonly PUSHW_4: 188;
|
|
223
|
+
readonly PUSHW_5: 189;
|
|
224
|
+
readonly PUSHW_6: 190;
|
|
225
|
+
readonly PUSHW_7: 191;
|
|
226
|
+
readonly RS: 67;
|
|
227
|
+
readonly WS: 66;
|
|
228
|
+
readonly RCVT: 69;
|
|
229
|
+
readonly WCVTP: 68;
|
|
230
|
+
readonly WCVTF: 112;
|
|
231
|
+
readonly DUP: 32;
|
|
232
|
+
readonly POP: 33;
|
|
233
|
+
readonly CLEAR: 34;
|
|
234
|
+
readonly SWAP: 35;
|
|
235
|
+
readonly DEPTH: 36;
|
|
236
|
+
readonly CINDEX: 37;
|
|
237
|
+
readonly MINDEX: 38;
|
|
238
|
+
readonly ROLL: 138;
|
|
239
|
+
readonly ADD: 96;
|
|
240
|
+
readonly SUB: 97;
|
|
241
|
+
readonly DIV: 98;
|
|
242
|
+
readonly MUL: 99;
|
|
243
|
+
readonly ABS: 100;
|
|
244
|
+
readonly NEG: 101;
|
|
245
|
+
readonly FLOOR: 102;
|
|
246
|
+
readonly CEILING: 103;
|
|
247
|
+
readonly MAX: 139;
|
|
248
|
+
readonly MIN: 140;
|
|
249
|
+
readonly LT: 80;
|
|
250
|
+
readonly LTEQ: 81;
|
|
251
|
+
readonly GT: 82;
|
|
252
|
+
readonly GTEQ: 83;
|
|
253
|
+
readonly EQ: 84;
|
|
254
|
+
readonly NEQ: 85;
|
|
255
|
+
readonly ODD: 86;
|
|
256
|
+
readonly EVEN: 87;
|
|
257
|
+
readonly AND: 90;
|
|
258
|
+
readonly OR: 91;
|
|
259
|
+
readonly NOT: 92;
|
|
260
|
+
readonly IF: 88;
|
|
261
|
+
readonly ELSE: 27;
|
|
262
|
+
readonly EIF: 89;
|
|
263
|
+
readonly JMPR: 28;
|
|
264
|
+
readonly JROT: 120;
|
|
265
|
+
readonly JROF: 121;
|
|
266
|
+
readonly FDEF: 44;
|
|
267
|
+
readonly ENDF: 45;
|
|
268
|
+
readonly CALL: 43;
|
|
269
|
+
readonly LOOPCALL: 42;
|
|
270
|
+
readonly IDEF: 137;
|
|
271
|
+
readonly SVTCA_Y: 0;
|
|
272
|
+
readonly SVTCA_X: 1;
|
|
273
|
+
readonly SPVTCA_Y: 2;
|
|
274
|
+
readonly SPVTCA_X: 3;
|
|
275
|
+
readonly SFVTCA_Y: 4;
|
|
276
|
+
readonly SFVTCA_X: 5;
|
|
277
|
+
readonly SPVTL_0: 6;
|
|
278
|
+
readonly SPVTL_1: 7;
|
|
279
|
+
readonly SFVTL_0: 8;
|
|
280
|
+
readonly SFVTL_1: 9;
|
|
281
|
+
readonly SDPVTL_0: 134;
|
|
282
|
+
readonly SDPVTL_1: 135;
|
|
283
|
+
readonly SPVFS: 10;
|
|
284
|
+
readonly SFVFS: 11;
|
|
285
|
+
readonly GPV: 12;
|
|
286
|
+
readonly GFV: 13;
|
|
287
|
+
readonly SFVTPV: 14;
|
|
288
|
+
readonly ISECT: 15;
|
|
289
|
+
readonly SRP0: 16;
|
|
290
|
+
readonly SRP1: 17;
|
|
291
|
+
readonly SRP2: 18;
|
|
292
|
+
readonly SZP0: 19;
|
|
293
|
+
readonly SZP1: 20;
|
|
294
|
+
readonly SZP2: 21;
|
|
295
|
+
readonly SZPS: 22;
|
|
296
|
+
readonly SLOOP: 23;
|
|
297
|
+
readonly RTG: 24;
|
|
298
|
+
readonly RTHG: 25;
|
|
299
|
+
readonly SMD: 26;
|
|
300
|
+
readonly RDTG: 125;
|
|
301
|
+
readonly RUTG: 124;
|
|
302
|
+
readonly ROFF: 122;
|
|
303
|
+
readonly SROUND: 118;
|
|
304
|
+
readonly S45ROUND: 119;
|
|
305
|
+
readonly SCVTCI: 29;
|
|
306
|
+
readonly SSWCI: 30;
|
|
307
|
+
readonly SSW: 31;
|
|
308
|
+
readonly FLIPON: 77;
|
|
309
|
+
readonly FLIPOFF: 78;
|
|
310
|
+
readonly SANGW: 126;
|
|
311
|
+
readonly SDB: 94;
|
|
312
|
+
readonly SDS: 95;
|
|
313
|
+
readonly GC_0: 70;
|
|
314
|
+
readonly GC_1: 71;
|
|
315
|
+
readonly SCFS: 72;
|
|
316
|
+
readonly MD_0: 73;
|
|
317
|
+
readonly MD_1: 74;
|
|
318
|
+
readonly MPPEM: 75;
|
|
319
|
+
readonly MPS: 76;
|
|
320
|
+
readonly FLIPPT: 128;
|
|
321
|
+
readonly FLIPRGON: 129;
|
|
322
|
+
readonly FLIPRGOFF: 130;
|
|
323
|
+
readonly SHP_0: 50;
|
|
324
|
+
readonly SHP_1: 51;
|
|
325
|
+
readonly SHC_0: 52;
|
|
326
|
+
readonly SHC_1: 53;
|
|
327
|
+
readonly SHZ_0: 54;
|
|
328
|
+
readonly SHZ_1: 55;
|
|
329
|
+
readonly SHPIX: 56;
|
|
330
|
+
readonly IP: 57;
|
|
331
|
+
readonly MSIRP_0: 58;
|
|
332
|
+
readonly MSIRP_1: 59;
|
|
333
|
+
readonly ALIGNRP: 60;
|
|
334
|
+
readonly RTDG: 61;
|
|
335
|
+
readonly MIAP_0: 62;
|
|
336
|
+
readonly MIAP_1: 63;
|
|
337
|
+
readonly ALIGNPTS: 39;
|
|
338
|
+
readonly UTP: 41;
|
|
339
|
+
readonly MDAP_0: 46;
|
|
340
|
+
readonly MDAP_1: 47;
|
|
341
|
+
readonly IUP_Y: 48;
|
|
342
|
+
readonly IUP_X: 49;
|
|
343
|
+
readonly DELTAP1: 93;
|
|
344
|
+
readonly DELTAP2: 113;
|
|
345
|
+
readonly DELTAP3: 114;
|
|
346
|
+
readonly DELTAC1: 115;
|
|
347
|
+
readonly DELTAC2: 116;
|
|
348
|
+
readonly DELTAC3: 117;
|
|
349
|
+
readonly ROUND_0: 104;
|
|
350
|
+
readonly ROUND_1: 105;
|
|
351
|
+
readonly ROUND_2: 106;
|
|
352
|
+
readonly ROUND_3: 107;
|
|
353
|
+
readonly NROUND_0: 108;
|
|
354
|
+
readonly NROUND_1: 109;
|
|
355
|
+
readonly NROUND_2: 110;
|
|
356
|
+
readonly NROUND_3: 111;
|
|
357
|
+
readonly GETINFO: 136;
|
|
358
|
+
readonly INSTCTRL: 142;
|
|
359
|
+
readonly SCANCTRL: 133;
|
|
360
|
+
readonly SCANTYPE: 141;
|
|
361
|
+
readonly AA: 127;
|
|
362
|
+
readonly DEBUG: 79;
|
|
363
|
+
readonly MDRP_BASE: 192;
|
|
364
|
+
readonly MIRP_BASE: 224;
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Number of values popped from stack for each opcode
|
|
368
|
+
*/
|
|
369
|
+
export declare const OpcodePops: Record<number, number>;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ export type { BitmapGlyph, BitmapSize, CbdtTable, CblcTable, GlyphBitmapMetrics,
|
|
|
10
10
|
export { CbdtImageFormat, getBitmapGlyph, getColorBitmapSizes, hasColorBitmap, } from "./font/tables/cbdt.ts";
|
|
11
11
|
export { executeCff2CharString, executeCffCharString, getCffGlyphWidth, } from "./font/tables/cff-charstring.ts";
|
|
12
12
|
export type { CmapTable } from "./font/tables/cmap.ts";
|
|
13
|
+
export type { Affine2x3, BaseGlyphPaintRecord, BaseGlyphRecord, ClipBox, ClipRecord, ColorLine, ColorStop, ColrTable, ItemVariationData, ItemVariationStore, LayerRecord, Paint, PaintColrGlyph, PaintColrLayers, PaintComposite, PaintGlyph, PaintLinearGradient, PaintRadialGradient, PaintRotate, PaintScale, PaintSkew, PaintSolid, PaintSweepGradient, PaintTransform, PaintTranslate, RegionAxisCoordinates, VarColorLine, VarColorStop, VariationRegion, } from "./font/tables/colr.ts";
|
|
14
|
+
export { CompositeMode, Extend, getClipBox, getColorLayers, getColorPaint, getColorVariationDelta, getLayerPaint, hasColorGlyph, isColrV1, PaintFormat, parseColr, } from "./font/tables/colr.ts";
|
|
15
|
+
export type { Color, ColorPalette, CpalTable } from "./font/tables/cpal.ts";
|
|
16
|
+
export { colorToHex, colorToRgba, getColor, PaletteType, parseCpal, } from "./font/tables/cpal.ts";
|
|
17
|
+
export type { FeatTable, FeatureRecord, FeatureSetting, } from "./font/tables/feat.ts";
|
|
18
|
+
export { aatToOpenTypeTag, CaseSensitiveLayoutSetting, CharacterShapeSetting, ContextualAlternativesSetting, DiacriticsSetting, FeatureFlags, FeatureType, FractionsSetting, getAllFeatures, getDefaultSetting, getFeature, getSettingByValue, hasSettingValue, isExclusiveFeature, LigatureSetting, LowerCaseSetting, NumberCaseSetting, NumberSpacingSetting, openTypeTagToAat, parseFeat, SmartSwashSetting, StylisticAlternativesSetting, UpperCaseSetting, VerticalPositionSetting, } from "./font/tables/feat.ts";
|
|
13
19
|
export type { FvarTable, NamedInstance, VariationAxis, } from "./font/tables/fvar.ts";
|
|
14
20
|
export { normalizeAxisValue } from "./font/tables/fvar.ts";
|
|
15
21
|
export type { GdefTable } from "./font/tables/gdef.ts";
|
|
@@ -32,18 +38,12 @@ export { getGlyphLocation, hasGlyphOutline } from "./font/tables/loca.ts";
|
|
|
32
38
|
export type { MaxpTable } from "./font/tables/maxp.ts";
|
|
33
39
|
export type { MorxChain, MorxSubtable, MorxTable } from "./font/tables/morx.ts";
|
|
34
40
|
export { applyNonContextual, MorxSubtableType } from "./font/tables/morx.ts";
|
|
35
|
-
export type { FeatTable, FeatureRecord, FeatureSetting, } from "./font/tables/feat.ts";
|
|
36
|
-
export { aatToOpenTypeTag, CaseSensitiveLayoutSetting, CharacterShapeSetting, ContextualAlternativesSetting, DiacriticsSetting, FeatureFlags, FeatureType, FractionsSetting, getAllFeatures, getDefaultSetting, getFeature, getSettingByValue, hasSettingValue, isExclusiveFeature, LigatureSetting, LowerCaseSetting, NumberCaseSetting, NumberSpacingSetting, openTypeTagToAat, parseFeat, SmartSwashSetting, StylisticAlternativesSetting, UpperCaseSetting, VerticalPositionSetting, } from "./font/tables/feat.ts";
|
|
37
41
|
export type { MvarTable, MvarValueRecord } from "./font/tables/mvar.ts";
|
|
38
42
|
export { getCapHeightDelta, getHAscenderDelta, getHDescenderDelta, getMetricDelta, getXHeightDelta, MvarTags, } from "./font/tables/mvar.ts";
|
|
39
43
|
export type { SbixGlyph, SbixStrike, SbixTable } from "./font/tables/sbix.ts";
|
|
40
44
|
export { getAvailablePpemSizes, getGlyphBitmap as getSbixGlyphBitmap, getStrikeForPpem, hasGlyphBitmap, resolveDupeGlyph, SbixGraphicType, } from "./font/tables/sbix.ts";
|
|
41
45
|
export type { AxisRecord, AxisValue, AxisValueFormat1, AxisValueFormat2, AxisValueFormat3, AxisValueFormat4, StatTable, } from "./font/tables/stat.ts";
|
|
42
46
|
export { AxisValueFlags, findAxisValueByNameId, getAxisIndex, getAxisRecord, getAxisValueNumber, getAxisValuesForAxis, isElidableAxisValue, isOlderSiblingFont, matchAxisValue, } from "./font/tables/stat.ts";
|
|
43
|
-
export type { Affine2x3, BaseGlyphPaintRecord, BaseGlyphRecord, ClipBox, ClipRecord, ColorLine, ColorStop, ColrTable, ItemVariationData, ItemVariationStore, LayerRecord, Paint, PaintColrGlyph, PaintColrLayers, PaintComposite, PaintGlyph, PaintLinearGradient, PaintRadialGradient, PaintRotate, PaintScale, PaintSkew, PaintSolid, PaintSweepGradient, PaintTransform, PaintTranslate, RegionAxisCoordinates, VarColorLine, VarColorStop, VariationRegion, } from "./font/tables/colr.ts";
|
|
44
|
-
export { CompositeMode, Extend, getClipBox, getColorLayers, getColorPaint, getColorVariationDelta, getLayerPaint, hasColorGlyph, isColrV1, PaintFormat, parseColr, } from "./font/tables/colr.ts";
|
|
45
|
-
export type { Color, ColorPalette, CpalTable } from "./font/tables/cpal.ts";
|
|
46
|
-
export { colorToHex, colorToRgba, getColor, PaletteType, parseCpal } from "./font/tables/cpal.ts";
|
|
47
47
|
export type { SvgDocumentRecord, SvgTable } from "./font/tables/svg.ts";
|
|
48
48
|
export { getSvgDocument, getSvgGlyphIds, hasSvgGlyph, } from "./font/tables/svg.ts";
|
|
49
49
|
export type { TrackData, TrakTable } from "./font/tables/trak.ts";
|
|
@@ -63,6 +63,16 @@ export type { DeviceOrVariationIndex, DeviceTable, VariationIndexTable, } from "
|
|
|
63
63
|
export { applyDeviceAdjustment, getDeviceDelta, isVariationIndexTable, } from "./layout/structures/device.ts";
|
|
64
64
|
export type { Condition, ConditionSet, FeatureVariationRecord, FeatureVariations, } from "./layout/structures/feature-variations.ts";
|
|
65
65
|
export { applyFeatureVariations, evaluateConditionSet, findMatchingFeatureVariation, getSubstitutedLookups, } from "./layout/structures/feature-variations.ts";
|
|
66
|
+
export { getExactBounds } from "./raster/bbox.ts";
|
|
67
|
+
export { blendBitmap, convertBitmap, copyBitmap, emboldenBitmap, resizeBitmap, } from "./raster/bitmap-utils.ts";
|
|
68
|
+
export { blurBitmap, boxBlur, createGaussianKernel, gaussianBlur, } from "./raster/blur.ts";
|
|
69
|
+
export { type ColorStop as GradientColorStop, createGradientBitmap, type Gradient, interpolateGradient, type LinearGradient, type RadialGradient, rasterizePathWithGradient, } from "./raster/gradient.ts";
|
|
70
|
+
export { bitmapToGray, bitmapToRGBA, rasterizeGlyph, rasterizePath, rasterizeText, } from "./raster/rasterize.ts";
|
|
71
|
+
export { renderSdf, type SdfOptions } from "./raster/sdf.ts";
|
|
72
|
+
export { type LineCap, type LineJoin, type StrokerOptions, strokePath, } from "./raster/stroker.ts";
|
|
73
|
+
export { condensePath, emboldenPath, obliquePath, } from "./raster/synth.ts";
|
|
74
|
+
export type { Bitmap, RasterizedGlyph, RasterizeOptions, Span, } from "./raster/types.ts";
|
|
75
|
+
export { clearBitmap, createBitmap, FillRule, PixelMode, } from "./raster/types.ts";
|
|
66
76
|
export type { GlyphPath, PathCommand, ShapedGlyph } from "./render/path.ts";
|
|
67
77
|
export { contourToPath, createPath2D, getGlyphPath, getGlyphPathWithVariation, getTextWidth, glyphBufferToShapedGlyphs, glyphToSVG, pathToCanvas, pathToSVG, renderShapedText, renderShapedTextWithVariation, shapedTextToSVG, shapedTextToSVGWithVariation, } from "./render/path.ts";
|
|
68
78
|
export { applyFallbackKerning, applyFallbackMarkPositioning, } from "./shaper/fallback.ts";
|
|
@@ -71,10 +81,10 @@ export { createShapePlan, getOrCreateShapePlan, type ShapeFeature, type ShapePla
|
|
|
71
81
|
export { type FontLike, type ShapeOptions, shape } from "./shaper/shaper.ts";
|
|
72
82
|
export * from "./types.ts";
|
|
73
83
|
export { applyMirroring, type BidiParagraph, type BidiResult, BidiType, detectDirection, getCharType, getEmbeddings, getMirror, getVisualOrder, isLTR, isRTL, processBidi, reorderGlyphs, } from "./unicode/bidi.ts";
|
|
74
|
-
export { decompose, getCombiningClass, NormalizationMode, normalize, reorderMarks, } from "./unicode/normalize.ts";
|
|
75
84
|
export type { LineBreakAnalysis } from "./unicode/line-break.ts";
|
|
76
|
-
export {
|
|
77
|
-
export
|
|
78
|
-
export { GraphemeBreakProperty, WordBreakProperty, countGraphemes, findGraphemeBoundaries, findWordBoundaries, getGraphemeBreakProperty, getWordBreakProperty, splitGraphemes, splitWords, } from "./unicode/segmentation.ts";
|
|
85
|
+
export { analyzeLineBreaks, analyzeLineBreaksForGlyphs, analyzeLineBreaksFromCodepoints, BreakAction, BreakOpportunity, canBreakAt, findNextBreak, getAllBreakOpportunities, getLineBreakClass, LineBreakClass, mustBreakAt, } from "./unicode/line-break.ts";
|
|
86
|
+
export { decompose, getCombiningClass, NormalizationMode, normalize, reorderMarks, } from "./unicode/normalize.ts";
|
|
79
87
|
export type { ScriptRun } from "./unicode/script.ts";
|
|
80
|
-
export {
|
|
88
|
+
export { detectScript, getScript, getScriptDirection, getScriptRuns, getScripts, getScriptTag, isComplexScript, isScript, Script, } from "./unicode/script.ts";
|
|
89
|
+
export type { GraphemeBoundaries, WordBoundaries, } from "./unicode/segmentation.ts";
|
|
90
|
+
export { countGraphemes, findGraphemeBoundaries, findWordBoundaries, GraphemeBreakProperty, getGraphemeBreakProperty, getWordBreakProperty, splitGraphemes, splitWords, WordBreakProperty, } from "./unicode/segmentation.ts";
|