@jasy/pdf 1.0.0-alpha.4 → 1.0.0-alpha.6
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/README.md +5 -2
- package/dist/api/content.d.ts +9 -3
- package/dist/api/content.js +13 -3
- package/dist/api/descriptor.js +22 -1
- package/dist/api/dimension.d.ts +20 -0
- package/dist/api/dimension.js +16 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/layout.d.ts +65 -3
- package/dist/api/layout.js +71 -2
- package/dist/api/page-builder.d.ts +32 -0
- package/dist/api/page-builder.js +32 -0
- package/dist/api/structure.d.ts +19 -0
- package/dist/api/structure.js +25 -0
- package/dist/api/table.js +13 -5
- package/dist/api/text.d.ts +10 -1
- package/dist/api/text.js +32 -4
- package/dist/elements/container-element.d.ts +17 -1
- package/dist/elements/container-element.js +54 -22
- package/dist/elements/image-element.d.ts +23 -1
- package/dist/elements/image-element.js +54 -11
- package/dist/elements/index.d.ts +6 -0
- package/dist/elements/index.js +6 -0
- package/dist/elements/layout/anchor-element.d.ts +23 -0
- package/dist/elements/layout/anchor-element.js +27 -0
- package/dist/elements/layout/bookmark-element.d.ts +27 -0
- package/dist/elements/layout/bookmark-element.js +30 -0
- package/dist/elements/layout/link-element.d.ts +33 -0
- package/dist/elements/layout/link-element.js +39 -0
- package/dist/elements/layout/page-builder-element.d.ts +32 -0
- package/dist/elements/layout/page-builder-element.js +43 -0
- package/dist/elements/layout/rotated-box-element.d.ts +35 -0
- package/dist/elements/layout/rotated-box-element.js +54 -0
- package/dist/elements/layout/rotated-element.d.ts +32 -0
- package/dist/elements/layout/rotated-element.js +41 -0
- package/dist/elements/layout/struct-group.d.ts +28 -0
- package/dist/elements/layout/struct-group.js +42 -0
- package/dist/elements/page-element.d.ts +8 -0
- package/dist/elements/page-element.js +13 -1
- package/dist/elements/pdf-element.d.ts +35 -0
- package/dist/elements/pdf-element.js +34 -0
- package/dist/elements/rectangle-element.d.ts +11 -1
- package/dist/elements/rectangle-element.js +49 -13
- package/dist/elements/row-element.d.ts +11 -1
- package/dist/elements/row-element.js +37 -8
- package/dist/elements/text-element.d.ts +11 -1
- package/dist/elements/text-element.js +5 -2
- package/dist/ir/display-list.d.ts +137 -1
- package/dist/layout/box-constraints.d.ts +8 -0
- package/dist/layout/box-constraints.js +14 -0
- package/dist/layout/collect-images.d.ts +9 -0
- package/dist/layout/collect-images.js +34 -0
- package/dist/layout/fragmentation.js +9 -2
- package/dist/renderer/anchor-renderer.d.ts +6 -0
- package/dist/renderer/anchor-renderer.js +11 -0
- package/dist/renderer/bookmark-renderer.d.ts +6 -0
- package/dist/renderer/bookmark-renderer.js +11 -0
- package/dist/renderer/emoji-image.d.ts +9 -0
- package/dist/renderer/emoji-image.js +68 -0
- package/dist/renderer/image-renderer.d.ts +1 -1
- package/dist/renderer/image-renderer.js +10 -2
- package/dist/renderer/link-renderer.d.ts +6 -0
- package/dist/renderer/link-renderer.js +11 -0
- package/dist/renderer/page-builder-renderer.d.ts +6 -0
- package/dist/renderer/page-builder-renderer.js +11 -0
- package/dist/renderer/page-renderer.js +54 -4
- package/dist/renderer/pdf-backend.d.ts +16 -2
- package/dist/renderer/pdf-backend.js +135 -3
- package/dist/renderer/pdf-document-renderer.d.ts +16 -7
- package/dist/renderer/pdf-document-renderer.js +65 -33
- package/dist/renderer/pdf-renderer.js +58 -2
- package/dist/renderer/rotated-renderer.d.ts +7 -0
- package/dist/renderer/rotated-renderer.js +29 -0
- package/dist/renderer/struct-group-renderer.d.ts +10 -0
- package/dist/renderer/struct-group-renderer.js +24 -0
- package/dist/renderer/text-renderer.d.ts +3 -0
- package/dist/renderer/text-renderer.js +206 -5
- package/dist/text/emoji-codepoints.d.ts +1 -0
- package/dist/text/emoji-codepoints.js +29 -0
- package/dist/text/line-breaker.js +6 -3
- package/dist/utils/afm-parser.js +6 -4
- package/dist/utils/dest-registry.d.ts +19 -0
- package/dist/utils/dest-registry.js +32 -0
- package/dist/utils/flex-layout.d.ts +10 -3
- package/dist/utils/flex-layout.js +26 -6
- package/dist/utils/outline.d.ts +21 -0
- package/dist/utils/outline.js +80 -0
- package/dist/utils/pdf-object-manager.d.ts +26 -1
- package/dist/utils/pdf-object-manager.js +0 -0
- package/dist/utils/struct-tree.d.ts +44 -0
- package/dist/utils/struct-tree.js +130 -0
- package/dist/utils/ttf-parser.d.ts +73 -0
- package/dist/utils/ttf-parser.js +456 -16
- package/dist/utils/ua-xmp.d.ts +9 -0
- package/dist/utils/ua-xmp.js +32 -0
- package/package.json +1 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { OverflowPolicy } from "../layout/fragmentation.js";
|
|
2
|
+
import { TTFParser } from "./ttf-parser.js";
|
|
2
3
|
import type { SecurityHandler } from "../crypto/security-handler.js";
|
|
4
|
+
import type { Gradient } from "../ir/display-list.js";
|
|
5
|
+
import { StructTree } from "./struct-tree.js";
|
|
6
|
+
import { OutlineBuilder } from "./outline.js";
|
|
7
|
+
import { DestRegistry } from "./dest-registry.js";
|
|
3
8
|
import type { PDFConfig } from "../renderer/pdf-document-class.js";
|
|
4
9
|
import type { FontMetrics } from "./font-metrics.js";
|
|
5
10
|
interface FontIndexes {
|
|
@@ -21,6 +26,9 @@ export declare class PDFObjectManager implements FontMetrics {
|
|
|
21
26
|
private fonts;
|
|
22
27
|
private images;
|
|
23
28
|
private extGStates;
|
|
29
|
+
private shadings;
|
|
30
|
+
private emojiFontName?;
|
|
31
|
+
private emojiImage?;
|
|
24
32
|
private pdfConfig;
|
|
25
33
|
pageFormat: [number, number];
|
|
26
34
|
private afmParsers;
|
|
@@ -36,6 +44,12 @@ export declare class PDFObjectManager implements FontMetrics {
|
|
|
36
44
|
private security?;
|
|
37
45
|
private encJobs;
|
|
38
46
|
private encryptObjNum?;
|
|
47
|
+
private _struct;
|
|
48
|
+
get struct(): StructTree;
|
|
49
|
+
private _outline;
|
|
50
|
+
get outline(): OutlineBuilder;
|
|
51
|
+
private _dests;
|
|
52
|
+
get dests(): DestRegistry;
|
|
39
53
|
constructor();
|
|
40
54
|
addObject(content: string): number;
|
|
41
55
|
replaceObject(objectNumber: number, content: string): void;
|
|
@@ -77,6 +91,9 @@ export declare class PDFObjectManager implements FontMetrics {
|
|
|
77
91
|
finalizeEncryption(): Promise<void>;
|
|
78
92
|
registerExtGState(fillAlpha: number, strokeAlpha: number): string;
|
|
79
93
|
getAllExtGStatesRaw(): Map<string, number>;
|
|
94
|
+
registerShading(g: Gradient): string;
|
|
95
|
+
private buildShadingFunction;
|
|
96
|
+
getAllShadingsRaw(): Map<string, number>;
|
|
80
97
|
registerFont(fontName: string, fontStyle?: FontStyle, fullName?: string): FontIndexes;
|
|
81
98
|
registerCustomFont(name: string, data: Uint8Array, style?: FontStyle): void;
|
|
82
99
|
private ensureEmitted;
|
|
@@ -86,6 +103,15 @@ export declare class PDFObjectManager implements FontMetrics {
|
|
|
86
103
|
private resolveCustomStyle;
|
|
87
104
|
private getCustomFont;
|
|
88
105
|
isCustomFont(name?: string, style?: FontStyle): boolean;
|
|
106
|
+
getColorFont(name: string, style?: FontStyle): TTFParser | undefined;
|
|
107
|
+
setEmojiFont(name: string): void;
|
|
108
|
+
getEmojiFont(): string | undefined;
|
|
109
|
+
setEmojiImageSource(url: string, format: string): void;
|
|
110
|
+
getEmojiImageSource(): {
|
|
111
|
+
url: string;
|
|
112
|
+
format: string;
|
|
113
|
+
} | undefined;
|
|
114
|
+
private colorRenders;
|
|
89
115
|
getCustomFontResource(name: string, style?: FontStyle): FontIndexes | undefined;
|
|
90
116
|
encodeCustomText(name: string, text: string, style?: FontStyle): string;
|
|
91
117
|
private buildFontFile2;
|
|
@@ -94,7 +120,6 @@ export declare class PDFObjectManager implements FontMetrics {
|
|
|
94
120
|
private buildToUnicode;
|
|
95
121
|
private buildType0;
|
|
96
122
|
getStringWidth(text: string, fontFamily: string, fontSize: number, fontStyle: FontStyle): number;
|
|
97
|
-
private getCharCode;
|
|
98
123
|
private getAVMParserByFont;
|
|
99
124
|
getCharWidth(char: string, fontSize: number, fullFontName?: string, fontName?: string, fontStyle?: FontStyle): number;
|
|
100
125
|
private getKerning;
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { StructTag } from "../ir/display-list.js";
|
|
2
|
+
import type { PDFObjectManager } from "./pdf-object-manager.js";
|
|
3
|
+
/** Per-page tagging context: hands out page-local MCIDs and links them to their StructElem. */
|
|
4
|
+
export declare class PageStructContext {
|
|
5
|
+
readonly structParents: number;
|
|
6
|
+
private readonly tree;
|
|
7
|
+
private mcid;
|
|
8
|
+
constructor(structParents: number, tree: StructTree);
|
|
9
|
+
/** Marked-content delimiters for one drawable node. Tagged content gets an MCID linked to its (already
|
|
10
|
+
* registered) StructElem; untagged content becomes an Artifact (decoration, skipped by assistive tech). */
|
|
11
|
+
mark(tag?: StructTag): {
|
|
12
|
+
open: string;
|
|
13
|
+
close: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** Builds the PDF structure tree for accessible tagging. One instance per document (held by the object manager). */
|
|
17
|
+
export declare class StructTree {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
lang: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
private counter;
|
|
22
|
+
private structParentsCounter;
|
|
23
|
+
private elems;
|
|
24
|
+
private byStructId;
|
|
25
|
+
private stack;
|
|
26
|
+
private pageObjByStructParents;
|
|
27
|
+
/** Register a structure element for a logical element (keyed by its stable `structId`, so a paragraph or
|
|
28
|
+
* table split across pages resolves to the SAME element - MCIDs then accrue from every page). Its parent
|
|
29
|
+
* is the currently-open container, else the Document. Containers also push()/pop() around their children. */
|
|
30
|
+
openElement(structId: number, role: string, opts?: {
|
|
31
|
+
alt?: string;
|
|
32
|
+
}): number;
|
|
33
|
+
push(key: number): void;
|
|
34
|
+
pop(): void;
|
|
35
|
+
/** Begin a page: allocates its StructParents index (its slot in the ParentTree). */
|
|
36
|
+
beginPage(): PageStructContext;
|
|
37
|
+
/** Tie a page's StructParents index to its now-known page object number (for /Pg references). */
|
|
38
|
+
setPageObject(structParents: number, pageObjNum: number): void;
|
|
39
|
+
/** Link a page-local MCID to an element (called by the backend while serializing). */
|
|
40
|
+
linkMarkedContent(key: number, structParents: number, mcid: number): void;
|
|
41
|
+
/** Emit the struct-tree objects and return the catalog additions (`/MarkInfo`, `/StructTreeRoot`, `/Lang`).
|
|
42
|
+
* A no-op returning "" when disabled or nothing was tagged, so a plain document stays byte-identical. */
|
|
43
|
+
finalize(om: PDFObjectManager): string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Escapes a PDF literal string ( ... ) - the language tag is safe ASCII, but /Alt can carry arbitrary text.
|
|
2
|
+
const esc = (s) => s.replace(/\\/g, "\\\\").replace(/\(/g, "\\(").replace(/\)/g, "\\)");
|
|
3
|
+
// A structure role reaches the PDF as a raw name (/H1, /S /Table). Roles come from a controlled set,
|
|
4
|
+
// but restrict them to a safe PDF-name token anyway (defence-in-depth) so a stray "/", whitespace, or
|
|
5
|
+
// operator can never corrupt the content stream / object dictionary. Empty after stripping -> /Span.
|
|
6
|
+
const roleName = (role) => role.replace(/[^A-Za-z0-9]/g, "") || "Span";
|
|
7
|
+
/** Per-page tagging context: hands out page-local MCIDs and links them to their StructElem. */
|
|
8
|
+
export class PageStructContext {
|
|
9
|
+
constructor(structParents, tree) {
|
|
10
|
+
this.structParents = structParents;
|
|
11
|
+
this.tree = tree;
|
|
12
|
+
this.mcid = 0;
|
|
13
|
+
}
|
|
14
|
+
/** Marked-content delimiters for one drawable node. Tagged content gets an MCID linked to its (already
|
|
15
|
+
* registered) StructElem; untagged content becomes an Artifact (decoration, skipped by assistive tech). */
|
|
16
|
+
mark(tag) {
|
|
17
|
+
// Artifact = decoration, no properties -> BMC (BDC would need a second operand and is a syntax error).
|
|
18
|
+
if (!tag)
|
|
19
|
+
return { open: "/Artifact BMC\n", close: "EMC\n" };
|
|
20
|
+
const mcid = this.mcid++;
|
|
21
|
+
this.tree.linkMarkedContent(tag.key, this.structParents, mcid);
|
|
22
|
+
return { open: `/${roleName(tag.role)} <</MCID ${mcid}>> BDC\n`, close: "EMC\n" };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Builds the PDF structure tree for accessible tagging. One instance per document (held by the object manager). */
|
|
26
|
+
export class StructTree {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.enabled = false;
|
|
29
|
+
this.lang = "en-US";
|
|
30
|
+
this.counter = 0;
|
|
31
|
+
this.structParentsCounter = 0;
|
|
32
|
+
this.elems = new Map(); // insertion order = render order = reading order
|
|
33
|
+
this.byStructId = new Map(); // element structId -> element key (dedup across pages)
|
|
34
|
+
this.stack = []; // open containers; top is the current parent
|
|
35
|
+
this.pageObjByStructParents = new Map();
|
|
36
|
+
}
|
|
37
|
+
/** Register a structure element for a logical element (keyed by its stable `structId`, so a paragraph or
|
|
38
|
+
* table split across pages resolves to the SAME element - MCIDs then accrue from every page). Its parent
|
|
39
|
+
* is the currently-open container, else the Document. Containers also push()/pop() around their children. */
|
|
40
|
+
openElement(structId, role, opts) {
|
|
41
|
+
const existing = this.byStructId.get(structId);
|
|
42
|
+
if (existing !== undefined)
|
|
43
|
+
return existing; // already opened on an earlier page/fragment
|
|
44
|
+
const key = this.counter++;
|
|
45
|
+
this.byStructId.set(structId, key);
|
|
46
|
+
this.elems.set(key, {
|
|
47
|
+
key,
|
|
48
|
+
role,
|
|
49
|
+
alt: opts?.alt,
|
|
50
|
+
parent: this.stack[this.stack.length - 1],
|
|
51
|
+
mc: [],
|
|
52
|
+
});
|
|
53
|
+
return key;
|
|
54
|
+
}
|
|
55
|
+
push(key) {
|
|
56
|
+
this.stack.push(key);
|
|
57
|
+
}
|
|
58
|
+
pop() {
|
|
59
|
+
this.stack.pop();
|
|
60
|
+
}
|
|
61
|
+
/** Begin a page: allocates its StructParents index (its slot in the ParentTree). */
|
|
62
|
+
beginPage() {
|
|
63
|
+
return new PageStructContext(this.structParentsCounter++, this);
|
|
64
|
+
}
|
|
65
|
+
/** Tie a page's StructParents index to its now-known page object number (for /Pg references). */
|
|
66
|
+
setPageObject(structParents, pageObjNum) {
|
|
67
|
+
this.pageObjByStructParents.set(structParents, pageObjNum);
|
|
68
|
+
}
|
|
69
|
+
/** Link a page-local MCID to an element (called by the backend while serializing). */
|
|
70
|
+
linkMarkedContent(key, structParents, mcid) {
|
|
71
|
+
this.elems.get(key)?.mc.push({ structParents, mcid });
|
|
72
|
+
}
|
|
73
|
+
/** Emit the struct-tree objects and return the catalog additions (`/MarkInfo`, `/StructTreeRoot`, `/Lang`).
|
|
74
|
+
* A no-op returning "" when disabled or nothing was tagged, so a plain document stays byte-identical. */
|
|
75
|
+
finalize(om) {
|
|
76
|
+
if (!this.enabled || this.elems.size === 0)
|
|
77
|
+
return "";
|
|
78
|
+
// Reserve object numbers first - root <-> Document <-> elements <-> ParentTree reference each other.
|
|
79
|
+
const rootNum = om.addObject("");
|
|
80
|
+
const docNum = om.addObject("");
|
|
81
|
+
const parentTreeNum = om.addObject("");
|
|
82
|
+
const objNum = new Map();
|
|
83
|
+
for (const key of this.elems.keys())
|
|
84
|
+
objNum.set(key, om.addObject(""));
|
|
85
|
+
const pg = (structParents) => this.pageObjByStructParents.get(structParents);
|
|
86
|
+
const childrenOf = (parent) => [...this.elems.values()].filter((e) => e.parent === parent); // Map order = reading order
|
|
87
|
+
// One StructElem per registered element: /K = its child elements ++ its marked-content references.
|
|
88
|
+
for (const e of this.elems.values()) {
|
|
89
|
+
const kids = [
|
|
90
|
+
...childrenOf(e.key).map((c) => `${objNum.get(c.key)} 0 R`),
|
|
91
|
+
...e.mc.map((m) => `<< /Type /MCR /Pg ${pg(m.structParents)} 0 R /MCID ${m.mcid} >>`),
|
|
92
|
+
].join(" ");
|
|
93
|
+
const alt = e.alt ? ` /Alt (${esc(e.alt)})` : "";
|
|
94
|
+
// PDF/UA 7.5: a header cell needs a Scope so a reader can associate data cells with it. Our headers
|
|
95
|
+
// are a header ROW (the Table `header` option), so each TH is the head of its Column.
|
|
96
|
+
const attr = e.role === "TH" ? " /A << /O /Table /Scope /Column >>" : "";
|
|
97
|
+
const parentRef = e.parent !== undefined ? objNum.get(e.parent) : docNum;
|
|
98
|
+
om.replaceObject(objNum.get(e.key), `<< /Type /StructElem /S /${roleName(e.role)} /P ${parentRef} 0 R${alt}${attr} /K [ ${kids} ] >>`);
|
|
99
|
+
}
|
|
100
|
+
// The Document element wraps the top-level elements in reading order.
|
|
101
|
+
const docKids = childrenOf(undefined)
|
|
102
|
+
.map((e) => `${objNum.get(e.key)} 0 R`)
|
|
103
|
+
.join(" ");
|
|
104
|
+
om.replaceObject(docNum, `<< /Type /StructElem /S /Document /P ${rootNum} 0 R /K [ ${docKids} ] >>`);
|
|
105
|
+
// ParentTree: for each page (StructParents index), an array where [mcid] = the owning StructElem.
|
|
106
|
+
const byPage = new Map();
|
|
107
|
+
for (const e of this.elems.values()) {
|
|
108
|
+
for (const m of e.mc) {
|
|
109
|
+
const list = byPage.get(m.structParents) ?? [];
|
|
110
|
+
list.push({ mcid: m.mcid, key: e.key });
|
|
111
|
+
byPage.set(m.structParents, list);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const nums = [...byPage.keys()]
|
|
115
|
+
.sort((a, b) => a - b)
|
|
116
|
+
.map((sp) => {
|
|
117
|
+
const refs = byPage
|
|
118
|
+
.get(sp)
|
|
119
|
+
.slice()
|
|
120
|
+
.sort((a, b) => a.mcid - b.mcid)
|
|
121
|
+
.map((r) => `${objNum.get(r.key)} 0 R`)
|
|
122
|
+
.join(" ");
|
|
123
|
+
return `${sp} [ ${refs} ]`;
|
|
124
|
+
});
|
|
125
|
+
om.replaceObject(parentTreeNum, `<< /Nums [ ${nums.join(" ")} ] >>`);
|
|
126
|
+
om.replaceObject(rootNum, `<< /Type /StructTreeRoot /K ${docNum} 0 R /ParentTree ${parentTreeNum} 0 R ` +
|
|
127
|
+
`/ParentTreeNextKey ${this.structParentsCounter} >>`);
|
|
128
|
+
return `/MarkInfo << /Marked true >> /StructTreeRoot ${rootNum} 0 R /Lang (${esc(this.lang)})`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
export type GlyphPathCommand = {
|
|
2
|
+
type: "M";
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
} | {
|
|
6
|
+
type: "L";
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
} | {
|
|
10
|
+
type: "Q";
|
|
11
|
+
cx: number;
|
|
12
|
+
cy: number;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
} | {
|
|
16
|
+
type: "Z";
|
|
17
|
+
};
|
|
18
|
+
export interface RGBA {
|
|
19
|
+
r: number;
|
|
20
|
+
g: number;
|
|
21
|
+
b: number;
|
|
22
|
+
a: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ColorStop {
|
|
25
|
+
offset: number;
|
|
26
|
+
color: RGBA | null;
|
|
27
|
+
}
|
|
28
|
+
export type Paint = {
|
|
29
|
+
type: "solid";
|
|
30
|
+
color: RGBA | null;
|
|
31
|
+
} | {
|
|
32
|
+
type: "linearGradient";
|
|
33
|
+
p0: [number, number];
|
|
34
|
+
p1: [number, number];
|
|
35
|
+
stops: ColorStop[];
|
|
36
|
+
extend: "pad" | "repeat" | "reflect";
|
|
37
|
+
} | {
|
|
38
|
+
type: "radialGradient";
|
|
39
|
+
c0: [number, number, number];
|
|
40
|
+
c1: [number, number, number];
|
|
41
|
+
stops: ColorStop[];
|
|
42
|
+
extend: "pad" | "repeat" | "reflect";
|
|
43
|
+
};
|
|
44
|
+
export type Affine = [number, number, number, number, number, number];
|
|
45
|
+
export interface ColorGlyphLayer {
|
|
46
|
+
glyphId: number;
|
|
47
|
+
paint: Paint;
|
|
48
|
+
transform?: Affine;
|
|
49
|
+
}
|
|
1
50
|
export declare class TTFParser {
|
|
2
51
|
private data;
|
|
3
52
|
unitsPerEm: number;
|
|
@@ -6,10 +55,16 @@ export declare class TTFParser {
|
|
|
6
55
|
bbox: [number, number, number, number];
|
|
7
56
|
private numGlyphs;
|
|
8
57
|
private numHMetrics;
|
|
58
|
+
private indexToLocFormat;
|
|
9
59
|
private advanceWidths;
|
|
10
60
|
private cmap;
|
|
11
61
|
private cmapGroups;
|
|
12
62
|
private tables;
|
|
63
|
+
private colrBase;
|
|
64
|
+
private colrLayersOffset;
|
|
65
|
+
private palette;
|
|
66
|
+
private colrBaseV1;
|
|
67
|
+
private colrLayerListOffset;
|
|
13
68
|
constructor(data: Uint8Array);
|
|
14
69
|
getData(): Uint8Array;
|
|
15
70
|
glyphCount(): number;
|
|
@@ -26,4 +81,22 @@ export declare class TTFParser {
|
|
|
26
81
|
private readCmap;
|
|
27
82
|
private readCmapFormat4;
|
|
28
83
|
private readCmapFormat12;
|
|
84
|
+
hasGlyfOutlines(): boolean;
|
|
85
|
+
private glyfRange;
|
|
86
|
+
getGlyphPath(glyphId: number): GlyphPathCommand[];
|
|
87
|
+
private parseSimpleGlyph;
|
|
88
|
+
private readCoordinates;
|
|
89
|
+
private contourToCommands;
|
|
90
|
+
hasColorGlyphs(): boolean;
|
|
91
|
+
getColorGlyph(glyphId: number): ColorGlyphLayer[] | null;
|
|
92
|
+
private walkColrLayers;
|
|
93
|
+
private resolveFill;
|
|
94
|
+
private readColorLine;
|
|
95
|
+
private paletteColor;
|
|
96
|
+
private u24;
|
|
97
|
+
private f2dot14;
|
|
98
|
+
private i32;
|
|
99
|
+
private readAffine;
|
|
100
|
+
private readColr;
|
|
101
|
+
private readCpal;
|
|
29
102
|
}
|