pdf-parser.js 5.2.25 → 5.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/afm-widths.cjs +1 -1
- package/dist/afm-widths.js +1 -1
- package/dist/annotations.d.cts +2 -2
- package/dist/annotations.d.ts +2 -2
- package/dist/attachments.d.cts +2 -2
- package/dist/attachments.d.ts +2 -2
- package/dist/builtin-encoding.cjs +1 -1
- package/dist/builtin-encoding.d.cts +2 -2
- package/dist/builtin-encoding.d.ts +2 -2
- package/dist/builtin-encoding.js +1 -1
- package/dist/cff-bounds.cjs +31 -21
- package/dist/cff-bounds.d.cts +1 -1
- package/dist/cff-bounds.d.ts +1 -1
- package/dist/cff-bounds.js +31 -21
- package/dist/cff.d.cts +1 -1
- package/dist/cff.d.ts +1 -1
- package/dist/cmap-table.d.cts +1 -1
- package/dist/cmap-table.d.ts +1 -1
- package/dist/cmap.d.cts +1 -1
- package/dist/cmap.d.ts +1 -1
- package/dist/content-read.d.cts +1 -1
- package/dist/content-read.d.ts +1 -1
- package/dist/content-write.cjs +19 -13
- package/dist/content-write.d.cts +3 -3
- package/dist/content-write.d.ts +3 -3
- package/dist/content-write.js +19 -13
- package/dist/document.cjs +17 -11
- package/dist/document.d.cts +5 -5
- package/dist/document.d.ts +5 -5
- package/dist/document.js +17 -11
- package/dist/{embedded-font-BRhZfEN2.d.ts → embedded-font-ByD7ZiQS.d.ts} +4 -4
- package/dist/{embedded-font-DJUn9kMH.d.cts → embedded-font-DgVBedw6.d.cts} +4 -4
- package/dist/embedded-font-write.d.cts +2 -2
- package/dist/embedded-font-write.d.ts +2 -2
- package/dist/embedded-font.cjs +1 -1
- package/dist/embedded-font.d.cts +1 -1
- package/dist/embedded-font.d.ts +1 -1
- package/dist/embedded-font.js +1 -1
- package/dist/encoding.cjs +1 -1
- package/dist/encoding.js +1 -1
- package/dist/encrypt-write.d.cts +3 -3
- package/dist/encrypt-write.d.ts +3 -3
- package/dist/encrypt.d.cts +3 -3
- package/dist/encrypt.d.ts +3 -3
- package/dist/filters.cjs +6 -6
- package/dist/filters.d.cts +1 -1
- package/dist/filters.d.ts +1 -1
- package/dist/filters.js +6 -6
- package/dist/font-read.cjs +1 -1
- package/dist/font-read.d.cts +3 -3
- package/dist/font-read.d.ts +3 -3
- package/dist/font-read.js +1 -1
- package/dist/font-registry.d.cts +3 -3
- package/dist/font-registry.d.ts +3 -3
- package/dist/form.cjs +13 -8
- package/dist/form.d.cts +2 -2
- package/dist/form.d.ts +2 -2
- package/dist/form.js +13 -8
- package/dist/gdef-table.d.cts +3 -3
- package/dist/gdef-table.d.ts +3 -3
- package/dist/{glyf-vMGtP1pb.d.ts → glyf-Bv1katwK.d.ts} +4 -4
- package/dist/{glyf-nXC-IDRW.d.cts → glyf-DFyknMrW.d.cts} +4 -4
- package/dist/{glyf-contours-OSdG6Edr.d.ts → glyf-contours-B1PsI9oA.d.ts} +2 -2
- package/dist/{glyf-contours-zRQbj-Yp.d.cts → glyf-contours-NHBpgks-.d.cts} +2 -2
- package/dist/glyf-contours.d.cts +1 -1
- package/dist/glyf-contours.d.ts +1 -1
- package/dist/glyf.d.cts +1 -1
- package/dist/glyf.d.ts +1 -1
- package/dist/gsub-table.cjs +13 -9
- package/dist/gsub-table.js +13 -9
- package/dist/hmtx-table.d.cts +1 -1
- package/dist/hmtx-table.d.ts +1 -1
- package/dist/image/jbig2-generic.cjs +2 -2
- package/dist/image/jbig2-generic.js +2 -2
- package/dist/image/jpeg2000-codestream.cjs +17 -8
- package/dist/image/jpeg2000-codestream.js +17 -8
- package/dist/image/jpeg2000-tagtree.cjs +1 -1
- package/dist/image/jpeg2000-tagtree.js +1 -1
- package/dist/images-read.d.cts +2 -2
- package/dist/images-read.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interpret.cjs +31 -18
- package/dist/interpret.d.cts +5 -5
- package/dist/interpret.d.ts +5 -5
- package/dist/interpret.js +31 -18
- package/dist/math-content-write.cjs +3 -3
- package/dist/math-content-write.js +3 -3
- package/dist/math-font-write.d.cts +1 -1
- package/dist/math-font-write.d.ts +1 -1
- package/dist/math-font.d.cts +4 -4
- package/dist/math-font.d.ts +4 -4
- package/dist/measure.cjs +1 -1
- package/dist/measure.js +1 -1
- package/dist/names.cjs +7 -7
- package/dist/names.d.cts +2 -2
- package/dist/names.d.ts +2 -2
- package/dist/names.js +7 -7
- package/dist/navigation.cjs +6 -7
- package/dist/navigation.d.cts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/navigation.js +6 -7
- package/dist/{objects-B7HdMeWS.d.ts → objects-e2RS3-yT.d.cts} +3 -3
- package/dist/{objects-B7HdMeWS.d.cts → objects-e2RS3-yT.d.ts} +3 -3
- package/dist/objects.d.cts +1 -1
- package/dist/objects.d.ts +1 -1
- package/dist/optional-content.d.cts +2 -2
- package/dist/optional-content.d.ts +2 -2
- package/dist/ot-layout-common.cjs +18 -13
- package/dist/ot-layout-common.d.cts +2 -2
- package/dist/ot-layout-common.d.ts +2 -2
- package/dist/ot-layout-common.js +18 -13
- package/dist/parse.cjs +5 -0
- package/dist/parse.d.cts +3 -2
- package/dist/parse.d.ts +3 -2
- package/dist/parse.js +5 -1
- package/dist/predictors.d.cts +1 -1
- package/dist/predictors.d.ts +1 -1
- package/dist/raster.cjs +10 -40
- package/dist/raster.d.cts +11 -11
- package/dist/raster.d.ts +11 -11
- package/dist/raster.js +10 -40
- package/dist/read.cjs +12 -8
- package/dist/read.js +12 -8
- package/dist/serialize.d.cts +1 -1
- package/dist/serialize.d.ts +1 -1
- package/dist/sfnt-subset.d.cts +1 -1
- package/dist/sfnt-subset.d.ts +1 -1
- package/dist/structure.cjs +4 -4
- package/dist/structure.d.cts +2 -2
- package/dist/structure.d.ts +2 -2
- package/dist/structure.js +4 -4
- package/dist/text-layout.d.cts +1 -1
- package/dist/text-layout.d.ts +1 -1
- package/dist/tounicode.d.cts +1 -1
- package/dist/tounicode.d.ts +1 -1
- package/dist/winansi.cjs +1 -1
- package/dist/winansi.js +1 -1
- package/dist/write.cjs +4 -4
- package/dist/write.d.cts +1 -1
- package/dist/write.d.ts +1 -1
- package/dist/write.js +4 -4
- package/dist/xref.d.cts +1 -1
- package/dist/xref.d.ts +1 -1
- package/package.json +2 -2
- package/dist/{afm-widths-BTu0IDp2.cjs → afm-widths-BYiX2L9D.cjs} +1 -1
- package/dist/{afm-widths-De_QMWgC.js → afm-widths-blUDDjlI.js} +1 -1
package/dist/ot-layout-common.js
CHANGED
|
@@ -11,21 +11,18 @@ function findRange(ranges, glyphId) {
|
|
|
11
11
|
else return range;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function placeGlyph(ranges, glyphId, value, valueStep) {
|
|
15
15
|
const previous = ranges[ranges.length - 1];
|
|
16
|
-
if (previous !== void 0 && glyphId === previous.endGlyphId + 1 && value === previous.value + (previous.endGlyphId - previous.startGlyphId + 1) * valueStep) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
ranges.push({
|
|
16
|
+
if (previous !== void 0 && glyphId === previous.endGlyphId + 1 && value === previous.value + (previous.endGlyphId - previous.startGlyphId + 1) * valueStep) return { extended: {
|
|
17
|
+
startGlyphId: previous.startGlyphId,
|
|
18
|
+
endGlyphId: glyphId,
|
|
19
|
+
value: previous.value
|
|
20
|
+
} };
|
|
21
|
+
return { fresh: {
|
|
25
22
|
startGlyphId: glyphId,
|
|
26
23
|
endGlyphId: glyphId,
|
|
27
24
|
value
|
|
28
|
-
}
|
|
25
|
+
} };
|
|
29
26
|
}
|
|
30
27
|
const RANGE_RECORD_SIZE = 6;
|
|
31
28
|
function parseRangeRecords(bytes, recordsOffset, recordCount) {
|
|
@@ -55,7 +52,11 @@ function parseCoverage(bytes, coverageOffset) {
|
|
|
55
52
|
const glyphArrayOffset = coverageOffset + COVERAGE_HEADER_SIZE;
|
|
56
53
|
if (!hasBytes(bytes, glyphArrayOffset, count * 2)) return;
|
|
57
54
|
ranges = [];
|
|
58
|
-
for (let i = 0; i < count; i++)
|
|
55
|
+
for (let i = 0; i < count; i++) {
|
|
56
|
+
const placement = placeGlyph(ranges, u16(bytes, glyphArrayOffset + i * 2), i, 1);
|
|
57
|
+
if (placement.extended !== void 0) ranges[ranges.length - 1] = placement.extended;
|
|
58
|
+
else ranges.push(placement.fresh);
|
|
59
|
+
}
|
|
59
60
|
ranges.sort((a, b) => a.startGlyphId - b.startGlyphId);
|
|
60
61
|
} else if (format === 2) ranges = parseRangeRecords(bytes, coverageOffset + COVERAGE_HEADER_SIZE, count);
|
|
61
62
|
if (ranges === void 0) return;
|
|
@@ -83,7 +84,11 @@ function parseClassDef(bytes, classDefOffset) {
|
|
|
83
84
|
const classArrayOffset = classDefOffset + CLASS_DEF_FORMAT_1_HEADER_SIZE;
|
|
84
85
|
if (!hasBytes(bytes, classArrayOffset, glyphCount * 2)) return;
|
|
85
86
|
ranges = [];
|
|
86
|
-
for (let i = 0; i < glyphCount; i++)
|
|
87
|
+
for (let i = 0; i < glyphCount; i++) {
|
|
88
|
+
const placement = placeGlyph(ranges, startGlyphId + i, u16(bytes, classArrayOffset + i * 2), 0);
|
|
89
|
+
if (placement.extended !== void 0) ranges[ranges.length - 1] = placement.extended;
|
|
90
|
+
else ranges.push(placement.fresh);
|
|
91
|
+
}
|
|
87
92
|
} else if (format === 2) ranges = parseRangeRecords(bytes, classDefOffset + CLASS_DEF_FORMAT_2_HEADER_SIZE, u16(bytes, classDefOffset + 2));
|
|
88
93
|
if (ranges === void 0) return;
|
|
89
94
|
const resolved = ranges;
|
package/dist/parse.cjs
CHANGED
|
@@ -22,6 +22,10 @@ function parseValue(reader, sink) {
|
|
|
22
22
|
});
|
|
23
23
|
return require_objects.pdfNull();
|
|
24
24
|
}
|
|
25
|
+
return assertNeverToken(token);
|
|
26
|
+
}
|
|
27
|
+
function assertNeverToken(token) {
|
|
28
|
+
throw new Error(`parseValue: unhandled token ${JSON.stringify(token)}`);
|
|
25
29
|
}
|
|
26
30
|
function parseKeywordValue(keyword, sink) {
|
|
27
31
|
if (keyword === "true") return require_objects.pdfBool(true);
|
|
@@ -226,5 +230,6 @@ function parseIndirectObject(reader, sink) {
|
|
|
226
230
|
};
|
|
227
231
|
}
|
|
228
232
|
//#endregion
|
|
233
|
+
exports.assertNeverToken = assertNeverToken;
|
|
229
234
|
exports.parseIndirectObject = parseIndirectObject;
|
|
230
235
|
exports.parseValue = parseValue;
|
package/dist/parse.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
|
-
import { r as PdfObject } from "./objects-
|
|
2
|
+
import { r as PdfObject } from "./objects-e2RS3-yT.cjs";
|
|
3
3
|
import { ByteReader } from "./bytes/reader.cjs";
|
|
4
4
|
//#region src/parse.d.ts
|
|
5
5
|
declare function parseValue(reader: ByteReader, sink: PdfDiagnosticSink): PdfObject | undefined;
|
|
6
|
+
declare function assertNeverToken(token: never): never;
|
|
6
7
|
interface ParsedIndirectObject {
|
|
7
8
|
readonly num: number;
|
|
8
9
|
readonly gen: number;
|
|
@@ -10,4 +11,4 @@ interface ParsedIndirectObject {
|
|
|
10
11
|
}
|
|
11
12
|
declare function parseIndirectObject(reader: ByteReader, sink: PdfDiagnosticSink): ParsedIndirectObject | undefined;
|
|
12
13
|
//#endregion
|
|
13
|
-
export { ParsedIndirectObject, parseIndirectObject, parseValue };
|
|
14
|
+
export { ParsedIndirectObject, assertNeverToken, parseIndirectObject, parseValue };
|
package/dist/parse.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
|
-
import { r as PdfObject } from "./objects-
|
|
2
|
+
import { r as PdfObject } from "./objects-e2RS3-yT.js";
|
|
3
3
|
import { ByteReader } from "./bytes/reader.js";
|
|
4
4
|
//#region src/parse.d.ts
|
|
5
5
|
declare function parseValue(reader: ByteReader, sink: PdfDiagnosticSink): PdfObject | undefined;
|
|
6
|
+
declare function assertNeverToken(token: never): never;
|
|
6
7
|
interface ParsedIndirectObject {
|
|
7
8
|
readonly num: number;
|
|
8
9
|
readonly gen: number;
|
|
@@ -10,4 +11,4 @@ interface ParsedIndirectObject {
|
|
|
10
11
|
}
|
|
11
12
|
declare function parseIndirectObject(reader: ByteReader, sink: PdfDiagnosticSink): ParsedIndirectObject | undefined;
|
|
12
13
|
//#endregion
|
|
13
|
-
export { ParsedIndirectObject, parseIndirectObject, parseValue };
|
|
14
|
+
export { ParsedIndirectObject, assertNeverToken, parseIndirectObject, parseValue };
|
package/dist/parse.js
CHANGED
|
@@ -21,6 +21,10 @@ function parseValue(reader, sink) {
|
|
|
21
21
|
});
|
|
22
22
|
return pdfNull();
|
|
23
23
|
}
|
|
24
|
+
return assertNeverToken(token);
|
|
25
|
+
}
|
|
26
|
+
function assertNeverToken(token) {
|
|
27
|
+
throw new Error(`parseValue: unhandled token ${JSON.stringify(token)}`);
|
|
24
28
|
}
|
|
25
29
|
function parseKeywordValue(keyword, sink) {
|
|
26
30
|
if (keyword === "true") return pdfBool(true);
|
|
@@ -225,4 +229,4 @@ function parseIndirectObject(reader, sink) {
|
|
|
225
229
|
};
|
|
226
230
|
}
|
|
227
231
|
//#endregion
|
|
228
|
-
export { parseIndirectObject, parseValue };
|
|
232
|
+
export { assertNeverToken, parseIndirectObject, parseValue };
|
package/dist/predictors.d.cts
CHANGED
package/dist/predictors.d.ts
CHANGED
package/dist/raster.cjs
CHANGED
|
@@ -533,39 +533,18 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
|
|
|
533
533
|
const subtype = require_objects.asName(require_objects.dictGet(fontDict, "Subtype"));
|
|
534
534
|
if (subtype === "Type0") {
|
|
535
535
|
const encoding = resolver.resolve(require_objects.dictGet(fontDict, "Encoding"));
|
|
536
|
-
if (encoding?.kind !== "name" || encoding.name !== "Identity-H" && encoding.name !== "Identity-V")
|
|
537
|
-
unavailable("a Type0 font whose /Encoding is neither Identity-H nor Identity-V (a predefined or embedded CMap this raster walk does not decode)");
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
536
|
+
if (encoding?.kind !== "name" || encoding.name !== "Identity-H" && encoding.name !== "Identity-V") return unavailable("a Type0 font whose /Encoding is neither Identity-H nor Identity-V (a predefined or embedded CMap this raster walk does not decode)");
|
|
540
537
|
const descendants = require_objects.asArray(require_objects.dictGet(fontDict, "DescendantFonts"));
|
|
541
538
|
const descendant = descendants !== void 0 ? resolver.resolveDict(descendants[0]) : void 0;
|
|
542
|
-
if (descendant === void 0)
|
|
543
|
-
unavailable("a Type0 font with no readable /DescendantFonts entry");
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
539
|
+
if (descendant === void 0) return unavailable("a Type0 font with no readable /DescendantFonts entry");
|
|
546
540
|
const descendantSubtype = require_objects.asName(require_objects.dictGet(descendant, "Subtype"));
|
|
547
|
-
if (descendantSubtype === "CIDFontType0")
|
|
548
|
-
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
if (descendantSubtype !== "CIDFontType2") {
|
|
552
|
-
unavailable(`a descendant font of subtype ${descendantSubtype ?? "(none)"}`);
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
541
|
+
if (descendantSubtype === "CIDFontType0") return cff();
|
|
542
|
+
if (descendantSubtype !== "CIDFontType2") return unavailable(`a descendant font of subtype ${descendantSubtype ?? "(none)"}`);
|
|
555
543
|
const cidToGidMap = resolver.resolve(require_objects.dictGet(descendant, "CIDToGIDMap"));
|
|
556
544
|
const program = openEmbeddedProgram(descendant, resolver);
|
|
557
|
-
if (program.kind === "cff")
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
if (program.kind === "absent") {
|
|
562
|
-
unavailable("no readable /FontFile2 (or glyf-bearing /FontFile3) stream");
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
if (cidToGidMap !== void 0 && cidToGidMap.kind !== "name" && cidToGidMap.kind !== "stream") {
|
|
566
|
-
unavailable("a /CIDToGIDMap that is neither /Identity nor a readable stream");
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
545
|
+
if (program.kind === "cff") return cff();
|
|
546
|
+
if (program.kind === "absent") return unavailable("no readable /FontFile2 (or glyf-bearing /FontFile3) stream");
|
|
547
|
+
if (cidToGidMap !== void 0 && cidToGidMap.kind !== "name" && cidToGidMap.kind !== "stream") return unavailable("a /CIDToGIDMap that is neither /Identity nor a readable stream");
|
|
569
548
|
if (cidToGidMap?.kind === "stream") {
|
|
570
549
|
const decodedBytes = require_filters.decodeStream(cidToGidMap.raw, cidToGidMap.dict, require_diagnostics.NOOP_DIAGNOSTIC_SINK).bytes;
|
|
571
550
|
const entries = [];
|
|
@@ -587,19 +566,10 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
|
|
|
587
566
|
}
|
|
588
567
|
if (subtype === "TrueType") {
|
|
589
568
|
const program = openEmbeddedProgram(fontDict, resolver);
|
|
590
|
-
if (program.kind === "cff")
|
|
591
|
-
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
if (program.kind === "absent") {
|
|
595
|
-
unavailable("no /FontDescriptor or no readable embedded program (a standard-14 or otherwise unembedded face states no outlines at all)");
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
569
|
+
if (program.kind === "cff") return cff();
|
|
570
|
+
if (program.kind === "absent") return unavailable("no /FontDescriptor or no readable embedded program (a standard-14 or otherwise unembedded face states no outlines at all)");
|
|
598
571
|
const cmapLookup = require_cmap_table.buildCmapLookup(program.sfnt);
|
|
599
|
-
if (cmapLookup === void 0)
|
|
600
|
-
unavailable("an embedded program with no usable Unicode cmap subtable");
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
572
|
+
if (cmapLookup === void 0) return unavailable("an embedded program with no usable Unicode cmap subtable");
|
|
603
573
|
return {
|
|
604
574
|
glyf: program.face.glyf,
|
|
605
575
|
unitsPerEm: program.face.unitsPerEm,
|
package/dist/raster.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
2
|
import { r as Matrix } from "./matrix-B7_SBKQ5.cjs";
|
|
3
|
-
import { n as GlyphOutline } from "./glyf-contours-
|
|
3
|
+
import { n as GlyphOutline } from "./glyf-contours-NHBpgks-.cjs";
|
|
4
4
|
import { Color } from "document-schema.js";
|
|
5
5
|
//#region src/raster.d.ts
|
|
6
6
|
type RasterMatrix = readonly [number, number, number, number, number, number];
|
|
@@ -63,9 +63,9 @@ interface RasterPageGeometry {
|
|
|
63
63
|
readonly heightPt: number;
|
|
64
64
|
}
|
|
65
65
|
interface PageRasteriser {
|
|
66
|
-
beginPage(geometry: RasterPageGeometry)
|
|
67
|
-
draw(op: RasterDrawOp)
|
|
68
|
-
finish()
|
|
66
|
+
beginPage: (geometry: RasterPageGeometry) => void;
|
|
67
|
+
draw: (op: RasterDrawOp) => void;
|
|
68
|
+
finish: () => Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>>;
|
|
69
69
|
}
|
|
70
70
|
interface RasterRegionPt {
|
|
71
71
|
readonly xPt: number;
|
|
@@ -80,24 +80,24 @@ interface RenderPdfPageOptions {
|
|
|
80
80
|
readonly sink?: PdfDiagnosticSink;
|
|
81
81
|
readonly signal?: AbortSignal;
|
|
82
82
|
}
|
|
83
|
-
declare function renderPdfPage(pdfBytes: Uint8Array<ArrayBuffer>, pageIndex: number, options: RenderPdfPageOptions, rasteriser: PageRasteriser): Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>>;
|
|
84
|
-
declare function flattenCubic(p0: {
|
|
83
|
+
declare function renderPdfPage(pdfBytes: Uint8Array<ArrayBuffer>, pageIndex: number, options: RenderPdfPageOptions, rasteriser: Readonly<PageRasteriser>): Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>>;
|
|
84
|
+
declare function flattenCubic(p0: Readonly<{
|
|
85
85
|
x: number;
|
|
86
86
|
y: number;
|
|
87
|
-
}
|
|
87
|
+
}>, c1: Readonly<{
|
|
88
88
|
x: number;
|
|
89
89
|
y: number;
|
|
90
|
-
}
|
|
90
|
+
}>, c2: Readonly<{
|
|
91
91
|
x: number;
|
|
92
92
|
y: number;
|
|
93
|
-
}
|
|
93
|
+
}>, p1: Readonly<{
|
|
94
94
|
x: number;
|
|
95
95
|
y: number;
|
|
96
|
-
}): readonly {
|
|
96
|
+
}>): readonly {
|
|
97
97
|
x: number;
|
|
98
98
|
y: number;
|
|
99
99
|
}[];
|
|
100
|
-
declare function drawGlyphOutline(outline: GlyphOutline, glyphMatrix: Matrix, color: Color
|
|
100
|
+
declare function drawGlyphOutline(outline: GlyphOutline, glyphMatrix: Matrix, color: Readonly<Color>, rasteriser: Readonly<PageRasteriser>): void;
|
|
101
101
|
declare function glyphOutlineSubpaths(outline: GlyphOutline, matrix: Matrix): readonly RasterSubpath[];
|
|
102
102
|
//#endregion
|
|
103
103
|
export { PageRasteriser, RasterDrawOp, RasterFillRectOp, RasterFillSpec, RasterImageOp, RasterMatrix, RasterPageGeometry, RasterPathOp, RasterPathSegment, RasterRegionPt, RasterStrokeSpec, RasterSubpath, RenderPdfPageOptions, drawGlyphOutline, flattenCubic, glyphOutlineSubpaths, renderPdfPage };
|
package/dist/raster.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
2
|
import { r as Matrix } from "./matrix-B7_SBKQ5.js";
|
|
3
|
-
import { n as GlyphOutline } from "./glyf-contours-
|
|
3
|
+
import { n as GlyphOutline } from "./glyf-contours-B1PsI9oA.js";
|
|
4
4
|
import { Color } from "document-schema.js";
|
|
5
5
|
//#region src/raster.d.ts
|
|
6
6
|
type RasterMatrix = readonly [number, number, number, number, number, number];
|
|
@@ -63,9 +63,9 @@ interface RasterPageGeometry {
|
|
|
63
63
|
readonly heightPt: number;
|
|
64
64
|
}
|
|
65
65
|
interface PageRasteriser {
|
|
66
|
-
beginPage(geometry: RasterPageGeometry)
|
|
67
|
-
draw(op: RasterDrawOp)
|
|
68
|
-
finish()
|
|
66
|
+
beginPage: (geometry: RasterPageGeometry) => void;
|
|
67
|
+
draw: (op: RasterDrawOp) => void;
|
|
68
|
+
finish: () => Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>>;
|
|
69
69
|
}
|
|
70
70
|
interface RasterRegionPt {
|
|
71
71
|
readonly xPt: number;
|
|
@@ -80,24 +80,24 @@ interface RenderPdfPageOptions {
|
|
|
80
80
|
readonly sink?: PdfDiagnosticSink;
|
|
81
81
|
readonly signal?: AbortSignal;
|
|
82
82
|
}
|
|
83
|
-
declare function renderPdfPage(pdfBytes: Uint8Array<ArrayBuffer>, pageIndex: number, options: RenderPdfPageOptions, rasteriser: PageRasteriser): Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>>;
|
|
84
|
-
declare function flattenCubic(p0: {
|
|
83
|
+
declare function renderPdfPage(pdfBytes: Uint8Array<ArrayBuffer>, pageIndex: number, options: RenderPdfPageOptions, rasteriser: Readonly<PageRasteriser>): Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>>;
|
|
84
|
+
declare function flattenCubic(p0: Readonly<{
|
|
85
85
|
x: number;
|
|
86
86
|
y: number;
|
|
87
|
-
}
|
|
87
|
+
}>, c1: Readonly<{
|
|
88
88
|
x: number;
|
|
89
89
|
y: number;
|
|
90
|
-
}
|
|
90
|
+
}>, c2: Readonly<{
|
|
91
91
|
x: number;
|
|
92
92
|
y: number;
|
|
93
|
-
}
|
|
93
|
+
}>, p1: Readonly<{
|
|
94
94
|
x: number;
|
|
95
95
|
y: number;
|
|
96
|
-
}): readonly {
|
|
96
|
+
}>): readonly {
|
|
97
97
|
x: number;
|
|
98
98
|
y: number;
|
|
99
99
|
}[];
|
|
100
|
-
declare function drawGlyphOutline(outline: GlyphOutline, glyphMatrix: Matrix, color: Color
|
|
100
|
+
declare function drawGlyphOutline(outline: GlyphOutline, glyphMatrix: Matrix, color: Readonly<Color>, rasteriser: Readonly<PageRasteriser>): void;
|
|
101
101
|
declare function glyphOutlineSubpaths(outline: GlyphOutline, matrix: Matrix): readonly RasterSubpath[];
|
|
102
102
|
//#endregion
|
|
103
103
|
export { PageRasteriser, RasterDrawOp, RasterFillRectOp, RasterFillSpec, RasterImageOp, RasterMatrix, RasterPageGeometry, RasterPathOp, RasterPathSegment, RasterRegionPt, RasterStrokeSpec, RasterSubpath, RenderPdfPageOptions, drawGlyphOutline, flattenCubic, glyphOutlineSubpaths, renderPdfPage };
|
package/dist/raster.js
CHANGED
|
@@ -532,39 +532,18 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
|
|
|
532
532
|
const subtype = asName(dictGet(fontDict, "Subtype"));
|
|
533
533
|
if (subtype === "Type0") {
|
|
534
534
|
const encoding = resolver.resolve(dictGet(fontDict, "Encoding"));
|
|
535
|
-
if (encoding?.kind !== "name" || encoding.name !== "Identity-H" && encoding.name !== "Identity-V")
|
|
536
|
-
unavailable("a Type0 font whose /Encoding is neither Identity-H nor Identity-V (a predefined or embedded CMap this raster walk does not decode)");
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
535
|
+
if (encoding?.kind !== "name" || encoding.name !== "Identity-H" && encoding.name !== "Identity-V") return unavailable("a Type0 font whose /Encoding is neither Identity-H nor Identity-V (a predefined or embedded CMap this raster walk does not decode)");
|
|
539
536
|
const descendants = asArray(dictGet(fontDict, "DescendantFonts"));
|
|
540
537
|
const descendant = descendants !== void 0 ? resolver.resolveDict(descendants[0]) : void 0;
|
|
541
|
-
if (descendant === void 0)
|
|
542
|
-
unavailable("a Type0 font with no readable /DescendantFonts entry");
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
538
|
+
if (descendant === void 0) return unavailable("a Type0 font with no readable /DescendantFonts entry");
|
|
545
539
|
const descendantSubtype = asName(dictGet(descendant, "Subtype"));
|
|
546
|
-
if (descendantSubtype === "CIDFontType0")
|
|
547
|
-
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
if (descendantSubtype !== "CIDFontType2") {
|
|
551
|
-
unavailable(`a descendant font of subtype ${descendantSubtype ?? "(none)"}`);
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
540
|
+
if (descendantSubtype === "CIDFontType0") return cff();
|
|
541
|
+
if (descendantSubtype !== "CIDFontType2") return unavailable(`a descendant font of subtype ${descendantSubtype ?? "(none)"}`);
|
|
554
542
|
const cidToGidMap = resolver.resolve(dictGet(descendant, "CIDToGIDMap"));
|
|
555
543
|
const program = openEmbeddedProgram(descendant, resolver);
|
|
556
|
-
if (program.kind === "cff")
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
if (program.kind === "absent") {
|
|
561
|
-
unavailable("no readable /FontFile2 (or glyf-bearing /FontFile3) stream");
|
|
562
|
-
return;
|
|
563
|
-
}
|
|
564
|
-
if (cidToGidMap !== void 0 && cidToGidMap.kind !== "name" && cidToGidMap.kind !== "stream") {
|
|
565
|
-
unavailable("a /CIDToGIDMap that is neither /Identity nor a readable stream");
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
544
|
+
if (program.kind === "cff") return cff();
|
|
545
|
+
if (program.kind === "absent") return unavailable("no readable /FontFile2 (or glyf-bearing /FontFile3) stream");
|
|
546
|
+
if (cidToGidMap !== void 0 && cidToGidMap.kind !== "name" && cidToGidMap.kind !== "stream") return unavailable("a /CIDToGIDMap that is neither /Identity nor a readable stream");
|
|
568
547
|
if (cidToGidMap?.kind === "stream") {
|
|
569
548
|
const decodedBytes = decodeStream(cidToGidMap.raw, cidToGidMap.dict, NOOP_DIAGNOSTIC_SINK).bytes;
|
|
570
549
|
const entries = [];
|
|
@@ -586,19 +565,10 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
|
|
|
586
565
|
}
|
|
587
566
|
if (subtype === "TrueType") {
|
|
588
567
|
const program = openEmbeddedProgram(fontDict, resolver);
|
|
589
|
-
if (program.kind === "cff")
|
|
590
|
-
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
if (program.kind === "absent") {
|
|
594
|
-
unavailable("no /FontDescriptor or no readable embedded program (a standard-14 or otherwise unembedded face states no outlines at all)");
|
|
595
|
-
return;
|
|
596
|
-
}
|
|
568
|
+
if (program.kind === "cff") return cff();
|
|
569
|
+
if (program.kind === "absent") return unavailable("no /FontDescriptor or no readable embedded program (a standard-14 or otherwise unembedded face states no outlines at all)");
|
|
597
570
|
const cmapLookup = buildCmapLookup(program.sfnt);
|
|
598
|
-
if (cmapLookup === void 0)
|
|
599
|
-
unavailable("an embedded program with no usable Unicode cmap subtable");
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
571
|
+
if (cmapLookup === void 0) return unavailable("an embedded program with no usable Unicode cmap subtable");
|
|
602
572
|
return {
|
|
603
573
|
glyf: program.face.glyf,
|
|
604
574
|
unitsPerEm: program.face.unitsPerEm,
|
package/dist/read.cjs
CHANGED
|
@@ -58,7 +58,9 @@ function readPdf(bytes, options) {
|
|
|
58
58
|
const pageBoxRows = [];
|
|
59
59
|
const pages = pageDicts.map((pageDict, index) => {
|
|
60
60
|
require_util_abort.throwIfAborted(signal);
|
|
61
|
-
|
|
61
|
+
const read = readPage(index, pageDict, doc, fontResolver, images, imageIdCache, destinationRegistry, optionalContent.layerNameOf, structure.ownerOf, sink);
|
|
62
|
+
if (read.boxRow !== void 0) pageBoxRows.push(read.boxRow);
|
|
63
|
+
return read.page;
|
|
62
64
|
});
|
|
63
65
|
if (pageBoxRows.length > 0) source["page-boxes"] = {
|
|
64
66
|
format: "pdf",
|
|
@@ -275,7 +277,7 @@ function pageBoxResidueEntry(pageIndex, page, mediaBox, cropBox) {
|
|
|
275
277
|
for (const [key, value] of declaredBoxes) if (value !== void 0) entries[key] = value;
|
|
276
278
|
return require_objects.pdfDict(entries);
|
|
277
279
|
}
|
|
278
|
-
function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache, destinationRegistry, layerNameOf, structureOwnerOf,
|
|
280
|
+
function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache, destinationRegistry, layerNameOf, structureOwnerOf, sink) {
|
|
279
281
|
const resources = resolver.resolveDict(require_objects.dictGet(page, "Resources"));
|
|
280
282
|
const mediaBox = readMediaBox(page);
|
|
281
283
|
let cropBox = readDeclaredPageBox(page, "CropBox") ?? mediaBox;
|
|
@@ -294,7 +296,6 @@ function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache,
|
|
|
294
296
|
const heightPt = visibleRect.maxY - visibleRect.minY;
|
|
295
297
|
const pageMatrix = require_matrix.multiplyMatrices(rotationResult.matrix, require_matrix.translationMatrix(-visibleRect.minX, -visibleRect.minY));
|
|
296
298
|
const boxRow = pageBoxResidueEntry(pageIndex, page, mediaBox, cropBox);
|
|
297
|
-
if (boxRow !== void 0) pageBoxRows.push(boxRow);
|
|
298
299
|
const items = [];
|
|
299
300
|
if (resources !== void 0) {
|
|
300
301
|
const contentBytes = readPageContentBytes(page, resolver, sink);
|
|
@@ -319,11 +320,14 @@ function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache,
|
|
|
319
320
|
const notes = readPageNotes(page, resolver);
|
|
320
321
|
const annotations = require_annotations.readPageAnnotations(page, pageMatrix, resolver, sink);
|
|
321
322
|
return {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
323
|
+
page: {
|
|
324
|
+
widthPt,
|
|
325
|
+
heightPt,
|
|
326
|
+
items,
|
|
327
|
+
...notes !== void 0 ? { notes } : {},
|
|
328
|
+
...annotations.length > 0 ? { annotations } : {}
|
|
329
|
+
},
|
|
330
|
+
boxRow
|
|
327
331
|
};
|
|
328
332
|
}
|
|
329
333
|
function withStructure(item, structure) {
|
package/dist/read.js
CHANGED
|
@@ -57,7 +57,9 @@ function readPdf(bytes, options) {
|
|
|
57
57
|
const pageBoxRows = [];
|
|
58
58
|
const pages = pageDicts.map((pageDict, index) => {
|
|
59
59
|
throwIfAborted(signal);
|
|
60
|
-
|
|
60
|
+
const read = readPage(index, pageDict, doc, fontResolver, images, imageIdCache, destinationRegistry, optionalContent.layerNameOf, structure.ownerOf, sink);
|
|
61
|
+
if (read.boxRow !== void 0) pageBoxRows.push(read.boxRow);
|
|
62
|
+
return read.page;
|
|
61
63
|
});
|
|
62
64
|
if (pageBoxRows.length > 0) source["page-boxes"] = {
|
|
63
65
|
format: "pdf",
|
|
@@ -274,7 +276,7 @@ function pageBoxResidueEntry(pageIndex, page, mediaBox, cropBox) {
|
|
|
274
276
|
for (const [key, value] of declaredBoxes) if (value !== void 0) entries[key] = value;
|
|
275
277
|
return pdfDict(entries);
|
|
276
278
|
}
|
|
277
|
-
function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache, destinationRegistry, layerNameOf, structureOwnerOf,
|
|
279
|
+
function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache, destinationRegistry, layerNameOf, structureOwnerOf, sink) {
|
|
278
280
|
const resources = resolver.resolveDict(dictGet(page, "Resources"));
|
|
279
281
|
const mediaBox = readMediaBox(page);
|
|
280
282
|
let cropBox = readDeclaredPageBox(page, "CropBox") ?? mediaBox;
|
|
@@ -293,7 +295,6 @@ function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache,
|
|
|
293
295
|
const heightPt = visibleRect.maxY - visibleRect.minY;
|
|
294
296
|
const pageMatrix = multiplyMatrices(rotationResult.matrix, translationMatrix(-visibleRect.minX, -visibleRect.minY));
|
|
295
297
|
const boxRow = pageBoxResidueEntry(pageIndex, page, mediaBox, cropBox);
|
|
296
|
-
if (boxRow !== void 0) pageBoxRows.push(boxRow);
|
|
297
298
|
const items = [];
|
|
298
299
|
if (resources !== void 0) {
|
|
299
300
|
const contentBytes = readPageContentBytes(page, resolver, sink);
|
|
@@ -318,11 +319,14 @@ function readPage(pageIndex, page, resolver, fontResolver, images, imageIdCache,
|
|
|
318
319
|
const notes = readPageNotes(page, resolver);
|
|
319
320
|
const annotations = readPageAnnotations(page, pageMatrix, resolver, sink);
|
|
320
321
|
return {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
page: {
|
|
323
|
+
widthPt,
|
|
324
|
+
heightPt,
|
|
325
|
+
items,
|
|
326
|
+
...notes !== void 0 ? { notes } : {},
|
|
327
|
+
...annotations.length > 0 ? { annotations } : {}
|
|
328
|
+
},
|
|
329
|
+
boxRow
|
|
326
330
|
};
|
|
327
331
|
}
|
|
328
332
|
function withStructure(item, structure) {
|
package/dist/serialize.d.cts
CHANGED
package/dist/serialize.d.ts
CHANGED
package/dist/sfnt-subset.d.cts
CHANGED
|
@@ -6,6 +6,6 @@ interface SfntSubsetResult {
|
|
|
6
6
|
readonly glyphIds: readonly number[];
|
|
7
7
|
readonly unmappedCodePoints: readonly number[];
|
|
8
8
|
}
|
|
9
|
-
declare function subsetSfnt(font: SfntFont, codePoints: Iterable<number
|
|
9
|
+
declare function subsetSfnt(font: SfntFont, codePoints: Readonly<Iterable<number>>, extraGlyphIds?: Readonly<Iterable<number>>): SfntSubsetResult | undefined;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { SfntSubsetResult, subsetSfnt };
|
package/dist/sfnt-subset.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ interface SfntSubsetResult {
|
|
|
6
6
|
readonly glyphIds: readonly number[];
|
|
7
7
|
readonly unmappedCodePoints: readonly number[];
|
|
8
8
|
}
|
|
9
|
-
declare function subsetSfnt(font: SfntFont, codePoints: Iterable<number
|
|
9
|
+
declare function subsetSfnt(font: SfntFont, codePoints: Readonly<Iterable<number>>, extraGlyphIds?: Readonly<Iterable<number>>): SfntSubsetResult | undefined;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { SfntSubsetResult, subsetSfnt };
|
package/dist/structure.cjs
CHANGED
|
@@ -2,6 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_objects = require("./objects.cjs");
|
|
3
3
|
const require_pdf_text = require("./pdf-text.cjs");
|
|
4
4
|
//#region src/structure.ts
|
|
5
|
+
const NEVER_DICT = {
|
|
6
|
+
kind: "dict",
|
|
7
|
+
entries: /* @__PURE__ */ new Map()
|
|
8
|
+
};
|
|
5
9
|
function readStructure(catalog, pages, resolver, sink) {
|
|
6
10
|
const root = resolver.resolveDict(require_objects.dictGet(catalog, "StructTreeRoot"));
|
|
7
11
|
if (root === void 0) return {
|
|
@@ -176,9 +180,5 @@ function parentTreeOwners(root, pages, resolver, idByDict, sink) {
|
|
|
176
180
|
});
|
|
177
181
|
return (pageIndex, mcid) => owners.get(`${pageIndex}:${mcid}`);
|
|
178
182
|
}
|
|
179
|
-
const NEVER_DICT = {
|
|
180
|
-
kind: "dict",
|
|
181
|
-
entries: /* @__PURE__ */ new Map()
|
|
182
|
-
};
|
|
183
183
|
//#endregion
|
|
184
184
|
exports.readStructure = readStructure;
|
package/dist/structure.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.cjs";
|
|
3
3
|
import { PdfObjectResolver } from "./interpret.cjs";
|
|
4
4
|
import { LayoutStructureElement } from "./layout.cjs";
|
|
5
5
|
//#region src/structure.d.ts
|
|
@@ -7,6 +7,6 @@ interface StructureContext {
|
|
|
7
7
|
readonly tree: readonly LayoutStructureElement[];
|
|
8
8
|
readonly ownerOf: (pageIndex: number, mcid: number) => string | undefined;
|
|
9
9
|
}
|
|
10
|
-
declare function readStructure(catalog: PdfDict, pages: readonly PdfDict[], resolver: PdfObjectResolver
|
|
10
|
+
declare function readStructure(catalog: PdfDict, pages: readonly PdfDict[], resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): StructureContext;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { StructureContext, readStructure };
|
package/dist/structure.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
|
-
import { n as PdfDict } from "./objects-
|
|
2
|
+
import { n as PdfDict } from "./objects-e2RS3-yT.js";
|
|
3
3
|
import { PdfObjectResolver } from "./interpret.js";
|
|
4
4
|
import { LayoutStructureElement } from "./layout.js";
|
|
5
5
|
//#region src/structure.d.ts
|
|
@@ -7,6 +7,6 @@ interface StructureContext {
|
|
|
7
7
|
readonly tree: readonly LayoutStructureElement[];
|
|
8
8
|
readonly ownerOf: (pageIndex: number, mcid: number) => string | undefined;
|
|
9
9
|
}
|
|
10
|
-
declare function readStructure(catalog: PdfDict, pages: readonly PdfDict[], resolver: PdfObjectResolver
|
|
10
|
+
declare function readStructure(catalog: PdfDict, pages: readonly PdfDict[], resolver: Readonly<PdfObjectResolver>, sink: PdfDiagnosticSink): StructureContext;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { StructureContext, readStructure };
|
package/dist/structure.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { asArray, asName, asNumber, dictGet } from "./objects.js";
|
|
2
2
|
import { decodePdfString } from "./pdf-text.js";
|
|
3
3
|
//#region src/structure.ts
|
|
4
|
+
const NEVER_DICT = {
|
|
5
|
+
kind: "dict",
|
|
6
|
+
entries: /* @__PURE__ */ new Map()
|
|
7
|
+
};
|
|
4
8
|
function readStructure(catalog, pages, resolver, sink) {
|
|
5
9
|
const root = resolver.resolveDict(dictGet(catalog, "StructTreeRoot"));
|
|
6
10
|
if (root === void 0) return {
|
|
@@ -175,9 +179,5 @@ function parentTreeOwners(root, pages, resolver, idByDict, sink) {
|
|
|
175
179
|
});
|
|
176
180
|
return (pageIndex, mcid) => owners.get(`${pageIndex}:${mcid}`);
|
|
177
181
|
}
|
|
178
|
-
const NEVER_DICT = {
|
|
179
|
-
kind: "dict",
|
|
180
|
-
entries: /* @__PURE__ */ new Map()
|
|
181
|
-
};
|
|
182
182
|
//#endregion
|
|
183
183
|
export { readStructure };
|
package/dist/text-layout.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Color, LayoutFont, StyledRun, TextMeasurer, WrapOptions, WrappedLine } from "document-schema.js";
|
|
2
2
|
//#region src/text-layout.d.ts
|
|
3
3
|
declare function wrapRunsToWidth(runs: readonly StyledRun[], measurer: TextMeasurer, maxWidthPt: number, options?: WrapOptions): WrappedLine[];
|
|
4
|
-
declare function wrapTextToWidth(text: string, font: LayoutFont
|
|
4
|
+
declare function wrapTextToWidth(text: string, font: Readonly<LayoutFont>, sizePt: number, color: Readonly<Color>, measurer: TextMeasurer, maxWidthPt: number): string[];
|
|
5
5
|
//#endregion
|
|
6
6
|
export { wrapRunsToWidth, wrapTextToWidth };
|
package/dist/text-layout.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Color, LayoutFont, StyledRun, TextMeasurer, WrapOptions, WrappedLine } from "document-schema.js";
|
|
2
2
|
//#region src/text-layout.d.ts
|
|
3
3
|
declare function wrapRunsToWidth(runs: readonly StyledRun[], measurer: TextMeasurer, maxWidthPt: number, options?: WrapOptions): WrappedLine[];
|
|
4
|
-
declare function wrapTextToWidth(text: string, font: LayoutFont
|
|
4
|
+
declare function wrapTextToWidth(text: string, font: Readonly<LayoutFont>, sizePt: number, color: Readonly<Color>, measurer: TextMeasurer, maxWidthPt: number): string[];
|
|
5
5
|
//#endregion
|
|
6
6
|
export { wrapRunsToWidth, wrapTextToWidth };
|
package/dist/tounicode.d.cts
CHANGED
package/dist/tounicode.d.ts
CHANGED
package/dist/winansi.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_afm_widths = require("./afm-widths-
|
|
2
|
+
const require_afm_widths = require("./afm-widths-BYiX2L9D.cjs");
|
|
3
3
|
exports.encodeForShow = require_afm_widths.encodeForShow;
|
|
4
4
|
exports.sanitizeToWinAnsi = require_afm_widths.sanitizeToWinAnsi;
|
|
5
5
|
exports.winAnsiCodeToUnicode = require_afm_widths.winAnsiCodeToUnicode;
|