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,20 @@
|
|
|
1
|
+
import type { TableRecord, Tag } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/** Font directory containing table records */
|
|
4
|
+
export interface FontDirectory {
|
|
5
|
+
sfntVersion: number;
|
|
6
|
+
numTables: number;
|
|
7
|
+
searchRange: number;
|
|
8
|
+
entrySelector: number;
|
|
9
|
+
rangeShift: number;
|
|
10
|
+
tables: Map<Tag, TableRecord>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse the sfnt font directory (table of contents).
|
|
14
|
+
* This is the first thing read from any TrueType/OpenType font.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseFontDirectory(reader: Reader): FontDirectory;
|
|
17
|
+
/** Check if this is a TrueType font (vs CFF) */
|
|
18
|
+
export declare function isTrueType(directory: FontDirectory): boolean;
|
|
19
|
+
/** Check if this is a CFF font */
|
|
20
|
+
export declare function isCFF(directory: FontDirectory): boolean;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Tag, uint16 } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Style Attributes table (STAT)
|
|
5
|
+
* Provides style information for variable fonts
|
|
6
|
+
* Used for font selection and naming
|
|
7
|
+
*/
|
|
8
|
+
export interface StatTable {
|
|
9
|
+
majorVersion: uint16;
|
|
10
|
+
minorVersion: uint16;
|
|
11
|
+
designAxisCount: uint16;
|
|
12
|
+
designAxes: AxisRecord[];
|
|
13
|
+
axisValueCount: uint16;
|
|
14
|
+
axisValues: AxisValue[];
|
|
15
|
+
elidedFallbackNameID?: uint16;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Design axis record
|
|
19
|
+
*/
|
|
20
|
+
export interface AxisRecord {
|
|
21
|
+
axisTag: Tag;
|
|
22
|
+
axisNameID: uint16;
|
|
23
|
+
axisOrdering: uint16;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Axis value flags
|
|
27
|
+
*/
|
|
28
|
+
export declare const AxisValueFlags: {
|
|
29
|
+
readonly OlderSiblingFontAttribute: 1;
|
|
30
|
+
readonly ElidableAxisValueName: 2;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Base axis value
|
|
34
|
+
*/
|
|
35
|
+
export interface AxisValueBase {
|
|
36
|
+
format: number;
|
|
37
|
+
axisIndex: uint16;
|
|
38
|
+
flags: uint16;
|
|
39
|
+
valueNameID: uint16;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Format 1: Single axis value
|
|
43
|
+
*/
|
|
44
|
+
export interface AxisValueFormat1 extends AxisValueBase {
|
|
45
|
+
format: 1;
|
|
46
|
+
value: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Format 2: Axis value range
|
|
50
|
+
*/
|
|
51
|
+
export interface AxisValueFormat2 extends AxisValueBase {
|
|
52
|
+
format: 2;
|
|
53
|
+
nominalValue: number;
|
|
54
|
+
rangeMinValue: number;
|
|
55
|
+
rangeMaxValue: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Format 3: Linked axis value
|
|
59
|
+
*/
|
|
60
|
+
export interface AxisValueFormat3 extends AxisValueBase {
|
|
61
|
+
format: 3;
|
|
62
|
+
value: number;
|
|
63
|
+
linkedValue: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Format 4: Multiple axis values
|
|
67
|
+
*/
|
|
68
|
+
export interface AxisValueFormat4 {
|
|
69
|
+
format: 4;
|
|
70
|
+
axisCount: uint16;
|
|
71
|
+
flags: uint16;
|
|
72
|
+
valueNameID: uint16;
|
|
73
|
+
axisValues: {
|
|
74
|
+
axisIndex: uint16;
|
|
75
|
+
value: number;
|
|
76
|
+
}[];
|
|
77
|
+
}
|
|
78
|
+
export type AxisValue = AxisValueFormat1 | AxisValueFormat2 | AxisValueFormat3 | AxisValueFormat4;
|
|
79
|
+
/**
|
|
80
|
+
* Parse STAT table
|
|
81
|
+
*/
|
|
82
|
+
export declare function parseStat(reader: Reader): StatTable;
|
|
83
|
+
/**
|
|
84
|
+
* Get axis record by tag
|
|
85
|
+
*/
|
|
86
|
+
export declare function getAxisRecord(stat: StatTable, axisTag: Tag): AxisRecord | null;
|
|
87
|
+
/**
|
|
88
|
+
* Get axis index by tag
|
|
89
|
+
*/
|
|
90
|
+
export declare function getAxisIndex(stat: StatTable, axisTag: Tag): number;
|
|
91
|
+
/**
|
|
92
|
+
* Get axis values for a specific axis
|
|
93
|
+
*/
|
|
94
|
+
export declare function getAxisValuesForAxis(stat: StatTable, axisIndex: number): AxisValue[];
|
|
95
|
+
/**
|
|
96
|
+
* Find axis value by name ID
|
|
97
|
+
*/
|
|
98
|
+
export declare function findAxisValueByNameId(stat: StatTable, nameId: uint16): AxisValue | null;
|
|
99
|
+
/**
|
|
100
|
+
* Check if axis value is elidable
|
|
101
|
+
*/
|
|
102
|
+
export declare function isElidableAxisValue(axisValue: AxisValue): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Check if axis value represents an older sibling font
|
|
105
|
+
*/
|
|
106
|
+
export declare function isOlderSiblingFont(axisValue: AxisValue): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Get the value for a format 1-3 axis value
|
|
109
|
+
*/
|
|
110
|
+
export declare function getAxisValueNumber(axisValue: AxisValue): number | null;
|
|
111
|
+
/**
|
|
112
|
+
* Match axis value to coordinates
|
|
113
|
+
* Returns true if the axis value matches the given coordinates
|
|
114
|
+
*/
|
|
115
|
+
export declare function matchAxisValue(axisValue: AxisValue, coords: Map<number, number>): boolean;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { GlyphId, uint16 } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* SVG table
|
|
5
|
+
* Contains SVG documents for color glyph rendering
|
|
6
|
+
*/
|
|
7
|
+
export interface SvgTable {
|
|
8
|
+
version: uint16;
|
|
9
|
+
documentRecords: SvgDocumentRecord[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* SVG document record
|
|
13
|
+
* Maps a range of glyphs to an SVG document
|
|
14
|
+
*/
|
|
15
|
+
export interface SvgDocumentRecord {
|
|
16
|
+
startGlyphID: GlyphId;
|
|
17
|
+
endGlyphID: GlyphId;
|
|
18
|
+
svgDoc: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parse SVG table
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseSvg(reader: Reader): SvgTable;
|
|
24
|
+
/**
|
|
25
|
+
* Get SVG document for a glyph
|
|
26
|
+
* Returns null if no SVG exists for this glyph
|
|
27
|
+
*/
|
|
28
|
+
export declare function getSvgDocument(svg: SvgTable, glyphId: GlyphId): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a glyph has an SVG representation
|
|
31
|
+
*/
|
|
32
|
+
export declare function hasSvgGlyph(svg: SvgTable, glyphId: GlyphId): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get all glyph IDs that have SVG representations
|
|
35
|
+
*/
|
|
36
|
+
export declare function getSvgGlyphIds(svg: SvgTable): GlyphId[];
|
|
37
|
+
/**
|
|
38
|
+
* Async version of gzip decompression
|
|
39
|
+
*/
|
|
40
|
+
export declare function decompressSvgDocument(data: Uint8Array): Promise<string>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { int16, uint16, uint32 } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Tracking table (trak)
|
|
5
|
+
* Apple Advanced Typography tracking
|
|
6
|
+
*/
|
|
7
|
+
export interface TrakTable {
|
|
8
|
+
version: number;
|
|
9
|
+
format: uint16;
|
|
10
|
+
horizData: TrackData | null;
|
|
11
|
+
vertData: TrackData | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Track data for one direction
|
|
15
|
+
*/
|
|
16
|
+
export interface TrackData {
|
|
17
|
+
nTracks: uint16;
|
|
18
|
+
nSizes: uint16;
|
|
19
|
+
sizeTableOffset: uint32;
|
|
20
|
+
trackTable: TrackTableEntry[];
|
|
21
|
+
sizeTable: number[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Track table entry
|
|
25
|
+
*/
|
|
26
|
+
export interface TrackTableEntry {
|
|
27
|
+
track: number;
|
|
28
|
+
nameIndex: uint16;
|
|
29
|
+
offset: uint16;
|
|
30
|
+
perSizeTracking: int16[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse trak table
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseTrak(reader: Reader): TrakTable;
|
|
36
|
+
/**
|
|
37
|
+
* Get tracking value for a given track and point size
|
|
38
|
+
*/
|
|
39
|
+
export declare function getTrackingValue(trackData: TrackData, track: number, pointSize: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Apply tracking to advance widths
|
|
42
|
+
*/
|
|
43
|
+
export declare function applyTracking(trak: TrakTable, advances: number[], pointSize: number, track?: number, vertical?: boolean): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { FWord, int16, uint16 } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Vertical Header table (vhea)
|
|
5
|
+
* Contains information for vertical layout
|
|
6
|
+
*/
|
|
7
|
+
export interface VheaTable {
|
|
8
|
+
/** Table version (1.0 or 1.1) */
|
|
9
|
+
version: {
|
|
10
|
+
major: number;
|
|
11
|
+
minor: number;
|
|
12
|
+
};
|
|
13
|
+
/** Typographic ascent (vertical) */
|
|
14
|
+
ascender: FWord;
|
|
15
|
+
/** Typographic descent (vertical) */
|
|
16
|
+
descender: FWord;
|
|
17
|
+
/** Typographic line gap (vertical) */
|
|
18
|
+
lineGap: FWord;
|
|
19
|
+
/** Maximum advance height */
|
|
20
|
+
advanceHeightMax: uint16;
|
|
21
|
+
/** Minimum top side bearing */
|
|
22
|
+
minTopSideBearing: FWord;
|
|
23
|
+
/** Minimum bottom side bearing */
|
|
24
|
+
minBottomSideBearing: FWord;
|
|
25
|
+
/** Maximum y extent (yMax - yMin) */
|
|
26
|
+
yMaxExtent: FWord;
|
|
27
|
+
/** Caret slope rise (for vertical text) */
|
|
28
|
+
caretSlopeRise: int16;
|
|
29
|
+
/** Caret slope run */
|
|
30
|
+
caretSlopeRun: int16;
|
|
31
|
+
/** Caret offset */
|
|
32
|
+
caretOffset: int16;
|
|
33
|
+
/** Metric data format (0 for current) */
|
|
34
|
+
metricDataFormat: int16;
|
|
35
|
+
/** Number of vertical metrics in vmtx */
|
|
36
|
+
numberOfVMetrics: uint16;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse vhea table
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseVhea(reader: Reader): VheaTable;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { GlyphId, int16, uint16 } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Vertical Metrics table (vmtx)
|
|
5
|
+
* Contains vertical metrics for each glyph
|
|
6
|
+
*/
|
|
7
|
+
export interface VmtxTable {
|
|
8
|
+
/** Vertical metrics (advance height + top side bearing) */
|
|
9
|
+
vMetrics: VerticalMetric[];
|
|
10
|
+
/** Top side bearings for remaining glyphs */
|
|
11
|
+
topSideBearings: int16[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Vertical metric record
|
|
15
|
+
*/
|
|
16
|
+
export interface VerticalMetric {
|
|
17
|
+
/** Advance height in font units */
|
|
18
|
+
advanceHeight: uint16;
|
|
19
|
+
/** Top side bearing in font units */
|
|
20
|
+
topSideBearing: int16;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse vmtx table
|
|
24
|
+
* @param reader Binary reader
|
|
25
|
+
* @param numberOfVMetrics From vhea table
|
|
26
|
+
* @param numGlyphs Total number of glyphs
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseVmtx(reader: Reader, numberOfVMetrics: number, numGlyphs: number): VmtxTable;
|
|
29
|
+
/**
|
|
30
|
+
* Get vertical metrics for a glyph
|
|
31
|
+
*/
|
|
32
|
+
export declare function getVerticalMetrics(vmtx: VmtxTable, glyphId: GlyphId): {
|
|
33
|
+
advanceHeight: number;
|
|
34
|
+
topSideBearing: number;
|
|
35
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { GlyphId, int16, uint16 } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Vertical Origin table (VORG)
|
|
5
|
+
* Provides y-coordinate of vertical origin for CFF fonts
|
|
6
|
+
* Used for proper vertical text layout in CJK fonts
|
|
7
|
+
*/
|
|
8
|
+
export interface VorgTable {
|
|
9
|
+
majorVersion: uint16;
|
|
10
|
+
minorVersion: uint16;
|
|
11
|
+
defaultVertOriginY: int16;
|
|
12
|
+
vertOriginYMetrics: VertOriginYMetric[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Vertical origin metric for a specific glyph
|
|
16
|
+
*/
|
|
17
|
+
export interface VertOriginYMetric {
|
|
18
|
+
glyphIndex: GlyphId;
|
|
19
|
+
vertOriginY: int16;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse VORG table
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseVorg(reader: Reader): VorgTable;
|
|
25
|
+
/**
|
|
26
|
+
* Get vertical origin Y coordinate for a glyph
|
|
27
|
+
* Returns the y-coordinate of the glyph's vertical origin
|
|
28
|
+
*/
|
|
29
|
+
export declare function getVertOriginY(vorg: VorgTable, glyphId: GlyphId): int16;
|
|
30
|
+
/**
|
|
31
|
+
* Check if a glyph has a specific vertical origin entry
|
|
32
|
+
*/
|
|
33
|
+
export declare function hasVertOriginY(vorg: VorgTable, glyphId: GlyphId): boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GlyphId } from "../../types.ts";
|
|
2
|
+
import type { Reader } from "../binary/reader.ts";
|
|
3
|
+
import { type DeltaSetIndexMap, type ItemVariationStore } from "./hvar.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Vertical Metrics Variations table (VVAR)
|
|
6
|
+
* Provides variations for vertical advance heights and side bearings
|
|
7
|
+
*/
|
|
8
|
+
export interface VvarTable {
|
|
9
|
+
majorVersion: number;
|
|
10
|
+
minorVersion: number;
|
|
11
|
+
itemVariationStore: ItemVariationStore;
|
|
12
|
+
advanceHeightMapping: DeltaSetIndexMap | null;
|
|
13
|
+
tsbMapping: DeltaSetIndexMap | null;
|
|
14
|
+
bsbMapping: DeltaSetIndexMap | null;
|
|
15
|
+
vOrgMapping: DeltaSetIndexMap | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parse VVAR table
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseVvar(reader: Reader): VvarTable;
|
|
21
|
+
/**
|
|
22
|
+
* Get advance height delta for a glyph at given variation coordinates
|
|
23
|
+
*/
|
|
24
|
+
export declare function getAdvanceHeightDelta(vvar: VvarTable, glyphId: GlyphId, coords: number[]): number;
|
|
25
|
+
/**
|
|
26
|
+
* Get top side bearing delta for a glyph at given variation coordinates
|
|
27
|
+
*/
|
|
28
|
+
export declare function getTsbDelta(vvar: VvarTable, glyphId: GlyphId, coords: number[]): number;
|
|
29
|
+
/**
|
|
30
|
+
* Get bottom side bearing delta for a glyph at given variation coordinates
|
|
31
|
+
*/
|
|
32
|
+
export declare function getBsbDelta(vvar: VvarTable, glyphId: GlyphId, coords: number[]): number;
|
|
33
|
+
/**
|
|
34
|
+
* Get vertical origin delta for a glyph at given variation coordinates
|
|
35
|
+
*/
|
|
36
|
+
export declare function getVorgDelta(vvar: VvarTable, glyphId: GlyphId, coords: number[]): number;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export { processContextual, processInsertion, processLigature, processRearrangement, } from "./aat/state-machine.ts";
|
|
2
|
+
export { GlyphBuffer } from "./buffer/glyph-buffer.ts";
|
|
3
|
+
export { UnicodeBuffer } from "./buffer/unicode-buffer.ts";
|
|
4
|
+
export { Reader } from "./font/binary/reader.ts";
|
|
5
|
+
export { createFace, Face } from "./font/face.ts";
|
|
6
|
+
export { Font, type FontLoadOptions } from "./font/font.ts";
|
|
7
|
+
export type { AvarTable, AxisSegmentMap } from "./font/tables/avar.ts";
|
|
8
|
+
export { applyAvar, applyAvarMapping } from "./font/tables/avar.ts";
|
|
9
|
+
export type { BitmapGlyph, BitmapSize, CbdtTable, CblcTable, GlyphBitmapMetrics, IndexSubTable, SbitLineMetrics, } from "./font/tables/cbdt.ts";
|
|
10
|
+
export { CbdtImageFormat, getBitmapGlyph, getColorBitmapSizes, hasColorBitmap, } from "./font/tables/cbdt.ts";
|
|
11
|
+
export { executeCff2CharString, executeCffCharString, getCffGlyphWidth, } from "./font/tables/cff-charstring.ts";
|
|
12
|
+
export type { CmapTable } from "./font/tables/cmap.ts";
|
|
13
|
+
export type { FvarTable, NamedInstance, VariationAxis, } from "./font/tables/fvar.ts";
|
|
14
|
+
export { normalizeAxisValue } from "./font/tables/fvar.ts";
|
|
15
|
+
export type { GdefTable } from "./font/tables/gdef.ts";
|
|
16
|
+
export type { CompositeGlyph, Contour, Glyph, GlyphPoint, SimpleGlyph, } from "./font/tables/glyf.ts";
|
|
17
|
+
export type { GposTable } from "./font/tables/gpos.ts";
|
|
18
|
+
export type { GsubTable } from "./font/tables/gsub.ts";
|
|
19
|
+
export type { GlyphVariationData, GvarTable, TupleVariationHeader, } from "./font/tables/gvar.ts";
|
|
20
|
+
export { calculateTupleScalar, getGlyphDelta } from "./font/tables/gvar.ts";
|
|
21
|
+
export type { HeadTable } from "./font/tables/head.ts";
|
|
22
|
+
export type { HheaTable } from "./font/tables/hhea.ts";
|
|
23
|
+
export type { HmtxTable } from "./font/tables/hmtx.ts";
|
|
24
|
+
export type { HvarTable } from "./font/tables/hvar.ts";
|
|
25
|
+
export { getAdvanceWidthDelta } from "./font/tables/hvar.ts";
|
|
26
|
+
export type { KernSubtable, KernTable } from "./font/tables/kern.ts";
|
|
27
|
+
export { getKernValue } from "./font/tables/kern.ts";
|
|
28
|
+
export type { KerxSubtable, KerxTable } from "./font/tables/kerx.ts";
|
|
29
|
+
export { getKerxValue } from "./font/tables/kerx.ts";
|
|
30
|
+
export type { LocaTable } from "./font/tables/loca.ts";
|
|
31
|
+
export { getGlyphLocation, hasGlyphOutline } from "./font/tables/loca.ts";
|
|
32
|
+
export type { MaxpTable } from "./font/tables/maxp.ts";
|
|
33
|
+
export type { MorxChain, MorxSubtable, MorxTable } from "./font/tables/morx.ts";
|
|
34
|
+
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
|
+
export type { MvarTable, MvarValueRecord } from "./font/tables/mvar.ts";
|
|
38
|
+
export { getCapHeightDelta, getHAscenderDelta, getHDescenderDelta, getMetricDelta, getXHeightDelta, MvarTags, } from "./font/tables/mvar.ts";
|
|
39
|
+
export type { SbixGlyph, SbixStrike, SbixTable } from "./font/tables/sbix.ts";
|
|
40
|
+
export { getAvailablePpemSizes, getGlyphBitmap as getSbixGlyphBitmap, getStrikeForPpem, hasGlyphBitmap, resolveDupeGlyph, SbixGraphicType, } from "./font/tables/sbix.ts";
|
|
41
|
+
export type { AxisRecord, AxisValue, AxisValueFormat1, AxisValueFormat2, AxisValueFormat3, AxisValueFormat4, StatTable, } from "./font/tables/stat.ts";
|
|
42
|
+
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
|
+
export type { SvgDocumentRecord, SvgTable } from "./font/tables/svg.ts";
|
|
48
|
+
export { getSvgDocument, getSvgGlyphIds, hasSvgGlyph, } from "./font/tables/svg.ts";
|
|
49
|
+
export type { TrackData, TrakTable } from "./font/tables/trak.ts";
|
|
50
|
+
export { applyTracking, getTrackingValue } from "./font/tables/trak.ts";
|
|
51
|
+
export type { VheaTable } from "./font/tables/vhea.ts";
|
|
52
|
+
export type { VerticalMetric, VmtxTable } from "./font/tables/vmtx.ts";
|
|
53
|
+
export { getVerticalMetrics } from "./font/tables/vmtx.ts";
|
|
54
|
+
export type { VertOriginYMetric, VorgTable } from "./font/tables/vorg.ts";
|
|
55
|
+
export { getVertOriginY, hasVertOriginY } from "./font/tables/vorg.ts";
|
|
56
|
+
export type { VvarTable } from "./font/tables/vvar.ts";
|
|
57
|
+
export { getAdvanceHeightDelta, getBsbDelta, getTsbDelta, getVorgDelta, } from "./font/tables/vvar.ts";
|
|
58
|
+
export type { JustifyAdjustment, JustifyOptions, JustifyResult, LineBreakResult, } from "./layout/justify.ts";
|
|
59
|
+
export { breakIntoLines, calculateLineWidth, JustifyMode, justify, justifyParagraph, } from "./layout/justify.ts";
|
|
60
|
+
export type { ClassDef } from "./layout/structures/class-def.ts";
|
|
61
|
+
export type { Coverage } from "./layout/structures/coverage.ts";
|
|
62
|
+
export type { DeviceOrVariationIndex, DeviceTable, VariationIndexTable, } from "./layout/structures/device.ts";
|
|
63
|
+
export { applyDeviceAdjustment, getDeviceDelta, isVariationIndexTable, } from "./layout/structures/device.ts";
|
|
64
|
+
export type { Condition, ConditionSet, FeatureVariationRecord, FeatureVariations, } from "./layout/structures/feature-variations.ts";
|
|
65
|
+
export { applyFeatureVariations, evaluateConditionSet, findMatchingFeatureVariation, getSubstitutedLookups, } from "./layout/structures/feature-variations.ts";
|
|
66
|
+
export type { GlyphPath, PathCommand, ShapedGlyph } from "./render/path.ts";
|
|
67
|
+
export { contourToPath, createPath2D, getGlyphPath, getGlyphPathWithVariation, getTextWidth, glyphBufferToShapedGlyphs, glyphToSVG, pathToCanvas, pathToSVG, renderShapedText, renderShapedTextWithVariation, shapedTextToSVG, shapedTextToSVGWithVariation, } from "./render/path.ts";
|
|
68
|
+
export { applyFallbackKerning, applyFallbackMarkPositioning, } from "./shaper/fallback.ts";
|
|
69
|
+
export { allSmallCaps, capitalSpacing, capsToSmallCaps, caseSensitiveForms, characterVariant, characterVariants, combineFeatures, contextualAlternates, discretionaryLigatures, feature, features, fractions, fullWidthForms, halfWidthForms, historicalLigatures, jis78Forms, jis83Forms, jis90Forms, jis2004Forms, kerning, liningFigures, oldstyleFigures, ordinals, petiteCaps, proportionalFigures, proportionalWidthForms, quarterWidthForms, ruby, scientificInferiors, simplifiedForms, slashedZero, smallCaps, standardLigatures, stylisticAlternates, stylisticSet, stylisticSets, subscript, superscript, swash, tabularFigures, thirdWidthForms, traditionalForms, verticalAlternatesRotation, verticalForms, verticalKanaAlternates, verticalLayoutFeatures, } from "./shaper/features.ts";
|
|
70
|
+
export { createShapePlan, getOrCreateShapePlan, type ShapeFeature, type ShapePlan, } from "./shaper/shape-plan.ts";
|
|
71
|
+
export { type FontLike, type ShapeOptions, shape } from "./shaper/shaper.ts";
|
|
72
|
+
export * from "./types.ts";
|
|
73
|
+
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
|
+
export type { LineBreakAnalysis } from "./unicode/line-break.ts";
|
|
76
|
+
export { BreakAction, BreakOpportunity, LineBreakClass, analyzeLineBreaks, analyzeLineBreaksForGlyphs, analyzeLineBreaksFromCodepoints, canBreakAt, findNextBreak, getAllBreakOpportunities, getLineBreakClass, mustBreakAt, } from "./unicode/line-break.ts";
|
|
77
|
+
export type { GraphemeBoundaries, WordBoundaries } from "./unicode/segmentation.ts";
|
|
78
|
+
export { GraphemeBreakProperty, WordBreakProperty, countGraphemes, findGraphemeBoundaries, findWordBoundaries, getGraphemeBreakProperty, getWordBreakProperty, splitGraphemes, splitWords, } from "./unicode/segmentation.ts";
|
|
79
|
+
export type { ScriptRun } from "./unicode/script.ts";
|
|
80
|
+
export { Script, detectScript, getScript, getScriptDirection, getScriptRuns, getScriptTag, getScripts, isComplexScript, isScript, } from "./unicode/script.ts";
|