pdf-parser.js 5.2.26 → 5.2.28
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-BYiX2L9D.cjs → afm-widths-BHD2HZIL.cjs} +553 -642
- package/dist/{afm-widths-blUDDjlI.js → afm-widths-B_IGbGky.js} +553 -642
- package/dist/afm-widths.cjs +1 -1
- package/dist/afm-widths.js +1 -1
- package/dist/annotations.cjs +5 -3
- package/dist/annotations.d.cts +2 -2
- package/dist/annotations.d.ts +2 -2
- package/dist/annotations.js +5 -3
- package/dist/attachments.d.cts +2 -2
- package/dist/attachments.d.ts +2 -2
- package/dist/builtin-encoding.cjs +17 -6
- package/dist/builtin-encoding.js +17 -6
- package/dist/bytes/crc32.cjs +5 -3
- package/dist/bytes/crc32.js +5 -3
- package/dist/bytes/flate.cjs +0 -1
- package/dist/bytes/flate.js +0 -1
- package/dist/cff-bounds.cjs +73 -45
- package/dist/cff-bounds.js +73 -45
- package/dist/cff.cjs +13 -6
- package/dist/cff.js +13 -6
- package/dist/cmap-table.cjs +54 -26
- package/dist/cmap-table.js +54 -26
- package/dist/cmap.cjs +5 -3
- package/dist/cmap.js +5 -3
- package/dist/content-read.d.cts +1 -1
- package/dist/content-read.d.ts +1 -1
- package/dist/content-write.cjs +21 -14
- package/dist/content-write.d.cts +2 -2
- package/dist/content-write.d.ts +2 -2
- package/dist/content-write.js +21 -14
- package/dist/crypto/aes.cjs +76 -55
- package/dist/crypto/aes.js +76 -55
- package/dist/crypto/md5.cjs +345 -149
- package/dist/crypto/md5.js +345 -149
- package/dist/crypto/rc4.cjs +5 -4
- package/dist/crypto/rc4.js +5 -4
- package/dist/crypto/sha2.cjs +92 -43
- package/dist/crypto/sha2.js +92 -43
- package/dist/document.cjs +17 -11
- package/dist/document.d.cts +1 -1
- package/dist/document.d.ts +1 -1
- package/dist/document.js +17 -11
- package/dist/{embedded-font-Bnhh4juV.d.ts → embedded-font-ByD7ZiQS.d.ts} +1 -1
- package/dist/{embedded-font-CEf-zBCA.d.cts → embedded-font-DgVBedw6.d.cts} +1 -1
- package/dist/embedded-font-write.d.cts +2 -2
- package/dist/embedded-font-write.d.ts +2 -2
- package/dist/embedded-font.cjs +4 -2
- package/dist/embedded-font.d.cts +1 -1
- package/dist/embedded-font.d.ts +1 -1
- package/dist/embedded-font.js +4 -2
- package/dist/encoding.cjs +1 -1
- package/dist/encoding.js +1 -1
- package/dist/encrypt-write.cjs +25 -21
- package/dist/encrypt-write.d.cts +1 -1
- package/dist/encrypt-write.d.ts +1 -1
- package/dist/encrypt-write.js +25 -21
- package/dist/encrypt.cjs +43 -64
- package/dist/encrypt.d.cts +1 -1
- package/dist/encrypt.d.ts +1 -1
- package/dist/encrypt.js +43 -64
- package/dist/filters.cjs +46 -26
- package/dist/filters.d.cts +1 -1
- package/dist/filters.d.ts +1 -1
- package/dist/filters.js +46 -26
- package/dist/font-face.cjs +2 -1
- package/dist/font-face.js +2 -1
- package/dist/font-read.cjs +12 -6
- package/dist/font-read.d.cts +1 -1
- package/dist/font-read.d.ts +1 -1
- package/dist/font-read.js +12 -6
- package/dist/font-registry.d.cts +3 -3
- package/dist/font-registry.d.ts +3 -3
- package/dist/font-tables.cjs +55 -28
- package/dist/font-tables.js +55 -28
- 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.cjs +6 -3
- package/dist/gdef-table.js +6 -3
- package/dist/{glyf-contours-C0epBNqP.d.ts → glyf-contours-B1PsI9oA.d.ts} +1 -1
- package/dist/{glyf-contours-BRpvd0rt.d.cts → glyf-contours-NHBpgks-.d.cts} +1 -1
- package/dist/glyf-contours.cjs +3 -1
- package/dist/glyf-contours.d.cts +1 -1
- package/dist/glyf-contours.d.ts +1 -1
- package/dist/glyf-contours.js +3 -1
- package/dist/glyf.cjs +22 -11
- package/dist/glyf.js +22 -11
- package/dist/gpos-table.cjs +37 -19
- package/dist/gpos-table.js +37 -19
- package/dist/gsub-table.cjs +40 -25
- package/dist/gsub-table.js +40 -25
- package/dist/hmtx-table.cjs +5 -3
- package/dist/hmtx-table.js +5 -3
- package/dist/image/ccitt-encode.cjs +8 -5
- package/dist/image/ccitt-encode.js +8 -5
- package/dist/image/ccitt.cjs +801 -209
- package/dist/image/ccitt.js +801 -209
- package/dist/image/jbig2-arith.cjs +340 -306
- package/dist/image/jbig2-arith.js +340 -306
- package/dist/image/jbig2-bitmap.cjs +8 -5
- package/dist/image/jbig2-bitmap.js +8 -5
- package/dist/image/jbig2-generic.cjs +240 -69
- package/dist/image/jbig2-generic.js +240 -69
- package/dist/image/jbig2-text.cjs +4 -2
- package/dist/image/jbig2-text.js +4 -2
- package/dist/image/jbig2.cjs +69 -31
- package/dist/image/jbig2.js +69 -31
- package/dist/image/jp2-boxes.cjs +52 -27
- package/dist/image/jp2-boxes.js +52 -27
- package/dist/image/jpeg-info.cjs +29 -24
- package/dist/image/jpeg-info.js +29 -24
- package/dist/image/jpeg2000-codestream.cjs +61 -32
- package/dist/image/jpeg2000-codestream.js +61 -32
- package/dist/image/jpeg2000-dwt.cjs +2 -1
- package/dist/image/jpeg2000-dwt.js +2 -1
- package/dist/image/jpeg2000-t1.cjs +21 -11
- package/dist/image/jpeg2000-t1.js +21 -11
- package/dist/image/jpeg2000-t2.cjs +12 -5
- package/dist/image/jpeg2000-t2.js +12 -5
- package/dist/image/jpeg2000-tagtree.cjs +8 -4
- package/dist/image/jpeg2000-tagtree.js +8 -4
- package/dist/image/jpeg2000.cjs +11 -6
- package/dist/image/jpeg2000.js +11 -6
- package/dist/image/png-decode.cjs +62 -39
- package/dist/image/png-decode.d.cts +3 -2
- package/dist/image/png-decode.d.ts +3 -2
- package/dist/image/png-decode.js +62 -39
- package/dist/image/png-filter.cjs +23 -15
- package/dist/image/png-filter.js +23 -15
- package/dist/images-read.cjs +41 -36
- package/dist/images-read.d.cts +2 -2
- package/dist/images-read.d.ts +2 -2
- package/dist/images-read.js +41 -36
- 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 +68 -40
- package/dist/interpret.d.cts +1 -1
- package/dist/interpret.d.ts +1 -1
- package/dist/interpret.js +68 -40
- package/dist/lexer.cjs +86 -51
- package/dist/lexer.js +86 -51
- package/dist/math-content-write.cjs +9 -5
- package/dist/math-content-write.js +9 -5
- package/dist/math-font-write.cjs +2 -1
- package/dist/math-font-write.d.cts +1 -1
- package/dist/math-font-write.d.ts +1 -1
- package/dist/math-font-write.js +2 -1
- package/dist/math-font.cjs +16 -7
- package/dist/math-font.js +16 -7
- package/dist/math-table.cjs +25 -13
- package/dist/math-table.js +25 -13
- package/dist/matrix.cjs +3 -2
- package/dist/matrix.js +3 -2
- 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 +16 -12
- package/dist/navigation.d.cts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.js +16 -12
- package/dist/{objects-B7HdMeWS.d.cts → objects-e2RS3-yT.d.cts} +3 -3
- package/dist/{objects-B7HdMeWS.d.ts → 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 +22 -15
- package/dist/ot-layout-common.js +22 -15
- package/dist/parse.cjs +7 -5
- package/dist/parse.d.cts +1 -1
- package/dist/parse.d.ts +1 -1
- package/dist/parse.js +7 -5
- package/dist/pdf-text.cjs +5 -2
- package/dist/pdf-text.js +5 -2
- package/dist/predictors.cjs +14 -9
- package/dist/predictors.d.cts +1 -1
- package/dist/predictors.d.ts +1 -1
- package/dist/predictors.js +14 -9
- package/dist/raster.cjs +30 -19
- package/dist/raster.d.cts +8 -8
- package/dist/raster.d.ts +8 -8
- package/dist/raster.js +30 -19
- package/dist/read.cjs +29 -16
- package/dist/read.js +29 -16
- package/dist/serialize.cjs +6 -2
- package/dist/serialize.d.cts +1 -1
- package/dist/serialize.d.ts +1 -1
- package/dist/serialize.js +6 -2
- package/dist/sfnt-subset.cjs +25 -13
- package/dist/sfnt-subset.d.cts +1 -1
- package/dist/sfnt-subset.d.ts +1 -1
- package/dist/sfnt-subset.js +25 -13
- package/dist/sfnt.cjs +20 -10
- package/dist/sfnt.js +20 -10
- package/dist/structure.d.cts +2 -2
- package/dist/structure.d.ts +2 -2
- package/dist/text-group.cjs +0 -1
- package/dist/text-group.js +0 -1
- package/dist/text-layout.d.cts +1 -1
- package/dist/text-layout.d.ts +1 -1
- package/dist/tounicode.cjs +4 -2
- package/dist/tounicode.d.cts +1 -1
- package/dist/tounicode.d.ts +1 -1
- package/dist/tounicode.js +4 -2
- package/dist/winansi.cjs +1 -1
- package/dist/winansi.js +1 -1
- package/dist/write.cjs +20 -12
- package/dist/write.d.cts +1 -1
- package/dist/write.d.ts +1 -1
- package/dist/write.js +20 -12
- package/dist/xref.cjs +5 -2
- package/dist/xref.d.cts +1 -1
- package/dist/xref.d.ts +1 -1
- package/dist/xref.js +5 -2
- package/package.json +1 -1
package/dist/filters.cjs
CHANGED
|
@@ -6,6 +6,8 @@ const require_image_ccitt = require("./image/ccitt.cjs");
|
|
|
6
6
|
const require_image_jbig2 = require("./image/jbig2.cjs");
|
|
7
7
|
const require_predictors = require("./predictors.cjs");
|
|
8
8
|
//#region src/filters.ts
|
|
9
|
+
const BITS_PER_BYTE = 8;
|
|
10
|
+
const BYTE_MASK = 255;
|
|
9
11
|
function decodeStream(raw, dict, sink, resolve) {
|
|
10
12
|
const filters = filterNames(dict);
|
|
11
13
|
const parms = decodeParmsList(dict, filters.length);
|
|
@@ -103,7 +105,7 @@ function jbig2Decode(data, parm, dict, sink, resolve) {
|
|
|
103
105
|
}
|
|
104
106
|
});
|
|
105
107
|
return {
|
|
106
|
-
bytes: Uint8Array.from(image.bytes, (byte) => byte ^
|
|
108
|
+
bytes: Uint8Array.from(image.bytes, (byte) => byte ^ BYTE_MASK),
|
|
107
109
|
globals
|
|
108
110
|
};
|
|
109
111
|
} catch (error) {
|
|
@@ -146,6 +148,9 @@ function decodeParmsList(dict, count) {
|
|
|
146
148
|
const LZW_CLEAR_TABLE = 256;
|
|
147
149
|
const LZW_EOD = 257;
|
|
148
150
|
const LZW_INITIAL_CODE_WIDTH = 9;
|
|
151
|
+
const LZW_CODE_WIDTH_10 = 10;
|
|
152
|
+
const LZW_CODE_WIDTH_11 = 11;
|
|
153
|
+
const LZW_CODE_WIDTH_12 = 12;
|
|
149
154
|
const LZW_FIRST_NEW_CODE = 258;
|
|
150
155
|
function initialLzwDictionary() {
|
|
151
156
|
return Array.from({ length: 256 }, (_, i) => new Uint8Array([i]));
|
|
@@ -169,9 +174,9 @@ function lzwDecode(data, earlyChange, sink) {
|
|
|
169
174
|
const readCode = () => {
|
|
170
175
|
while (bitCount < codeWidth) {
|
|
171
176
|
if (pos >= data.length) return;
|
|
172
|
-
bitBuffer = bitBuffer <<
|
|
177
|
+
bitBuffer = bitBuffer << BITS_PER_BYTE | data[pos];
|
|
173
178
|
pos++;
|
|
174
|
-
bitCount +=
|
|
179
|
+
bitCount += BITS_PER_BYTE;
|
|
175
180
|
}
|
|
176
181
|
const value = bitBuffer >>> bitCount - codeWidth & (1 << codeWidth) - 1;
|
|
177
182
|
bitCount -= codeWidth;
|
|
@@ -203,35 +208,40 @@ function lzwDecode(data, earlyChange, sink) {
|
|
|
203
208
|
if (prevEntry !== void 0) {
|
|
204
209
|
dict[nextCode] = concatTwo(prevEntry, new Uint8Array([entry[0] ?? 0]));
|
|
205
210
|
nextCode++;
|
|
206
|
-
if (nextCode + bias ===
|
|
207
|
-
else if (nextCode + bias ===
|
|
208
|
-
else if (nextCode + bias ===
|
|
211
|
+
if (nextCode + bias === 2 ** LZW_INITIAL_CODE_WIDTH) codeWidth = LZW_CODE_WIDTH_10;
|
|
212
|
+
else if (nextCode + bias === 2 ** LZW_CODE_WIDTH_10) codeWidth = LZW_CODE_WIDTH_11;
|
|
213
|
+
else if (nextCode + bias === 2 ** LZW_CODE_WIDTH_11) codeWidth = LZW_CODE_WIDTH_12;
|
|
209
214
|
}
|
|
210
215
|
prevEntry = entry;
|
|
211
216
|
}
|
|
212
217
|
return Uint8Array.from(out);
|
|
213
218
|
}
|
|
219
|
+
const ASCII85_GROUP_BYTES = 4;
|
|
214
220
|
const ASCII85_ZERO_GROUP_MARKER = 122;
|
|
215
221
|
const ASCII85_END_MARKER = 126;
|
|
216
222
|
const ASCII85_MIN_DIGIT = 33;
|
|
217
223
|
const ASCII85_MAX_DIGIT = 117;
|
|
218
224
|
const ASCII85_MAX_DIGIT_VALUE = 84;
|
|
219
|
-
|
|
225
|
+
const ASCII85_RADIX = 85;
|
|
226
|
+
const ASCII85_GROUP_DIGITS = 5;
|
|
227
|
+
const ASCII85_OPTIONAL_PREFIX_LT = 60;
|
|
228
|
+
const ASCII85_BYTE_3_SHIFT = 24;
|
|
229
|
+
const ASCII85_BYTE_2_SHIFT = 16;
|
|
230
|
+
function ascii85GroupBytes(digits, byteCount) {
|
|
220
231
|
let value = 0;
|
|
221
|
-
for (const digit of digits) value = value *
|
|
222
|
-
|
|
223
|
-
value >>>
|
|
224
|
-
value >>>
|
|
225
|
-
value >>>
|
|
226
|
-
value &
|
|
227
|
-
];
|
|
228
|
-
for (let i = 0; i < byteCount; i++) out.push(bytes[i]);
|
|
232
|
+
for (const digit of digits) value = value * ASCII85_RADIX + digit;
|
|
233
|
+
return [
|
|
234
|
+
value >>> ASCII85_BYTE_3_SHIFT & BYTE_MASK,
|
|
235
|
+
value >>> ASCII85_BYTE_2_SHIFT & BYTE_MASK,
|
|
236
|
+
value >>> BITS_PER_BYTE & BYTE_MASK,
|
|
237
|
+
value & BYTE_MASK
|
|
238
|
+
].slice(0, byteCount);
|
|
229
239
|
}
|
|
230
240
|
function ascii85Decode(data) {
|
|
231
241
|
const out = [];
|
|
232
242
|
let tuple = [];
|
|
233
243
|
let i = 0;
|
|
234
|
-
if (data.length >= 2 && data[0] ===
|
|
244
|
+
if (data.length >= 2 && data[0] === ASCII85_OPTIONAL_PREFIX_LT && data[1] === ASCII85_END_MARKER) i = 2;
|
|
235
245
|
for (; i < data.length; i++) {
|
|
236
246
|
const byte = data[i];
|
|
237
247
|
if (byte === ASCII85_END_MARKER) break;
|
|
@@ -242,36 +252,46 @@ function ascii85Decode(data) {
|
|
|
242
252
|
}
|
|
243
253
|
if (byte < ASCII85_MIN_DIGIT || byte > ASCII85_MAX_DIGIT) continue;
|
|
244
254
|
tuple.push(byte - ASCII85_MIN_DIGIT);
|
|
245
|
-
if (tuple.length ===
|
|
246
|
-
|
|
255
|
+
if (tuple.length === ASCII85_GROUP_DIGITS) {
|
|
256
|
+
out.push(...ascii85GroupBytes(tuple, ASCII85_GROUP_BYTES));
|
|
247
257
|
tuple = [];
|
|
248
258
|
}
|
|
249
259
|
}
|
|
250
260
|
if (tuple.length > 1) {
|
|
251
261
|
const padded = tuple.slice();
|
|
252
|
-
while (padded.length <
|
|
253
|
-
|
|
262
|
+
while (padded.length < ASCII85_GROUP_DIGITS) padded.push(ASCII85_MAX_DIGIT_VALUE);
|
|
263
|
+
out.push(...ascii85GroupBytes(padded, tuple.length - 1));
|
|
254
264
|
}
|
|
255
265
|
return Uint8Array.from(out);
|
|
256
266
|
}
|
|
267
|
+
const ASCII_DIGIT_ZERO = 48;
|
|
268
|
+
const ASCII_DIGIT_NINE = 57;
|
|
269
|
+
const ASCII_UPPER_A = 65;
|
|
270
|
+
const ASCII_UPPER_F = 70;
|
|
271
|
+
const ASCII_LOWER_A = 97;
|
|
272
|
+
const ASCII_LOWER_F = 102;
|
|
273
|
+
const HEX_LETTER_DIGIT_OFFSET = 10;
|
|
274
|
+
const ASCII_HEX_TERMINATOR = 62;
|
|
275
|
+
const HEX_NIBBLE_BITS = 4;
|
|
257
276
|
function hexDigitValue(byte) {
|
|
258
|
-
if (byte >=
|
|
259
|
-
if (byte >=
|
|
260
|
-
if (byte >=
|
|
277
|
+
if (byte >= ASCII_DIGIT_ZERO && byte <= ASCII_DIGIT_NINE) return byte - ASCII_DIGIT_ZERO;
|
|
278
|
+
if (byte >= ASCII_UPPER_A && byte <= ASCII_UPPER_F) return byte - ASCII_UPPER_A + HEX_LETTER_DIGIT_OFFSET;
|
|
279
|
+
if (byte >= ASCII_LOWER_A && byte <= ASCII_LOWER_F) return byte - ASCII_LOWER_A + HEX_LETTER_DIGIT_OFFSET;
|
|
261
280
|
}
|
|
262
281
|
function asciiHexDecode(data) {
|
|
263
282
|
const digits = [];
|
|
264
283
|
for (const byte of data) {
|
|
265
|
-
if (byte ===
|
|
284
|
+
if (byte === ASCII_HEX_TERMINATOR) break;
|
|
266
285
|
const value = hexDigitValue(byte);
|
|
267
286
|
if (value !== void 0) digits.push(value);
|
|
268
287
|
}
|
|
269
288
|
if (digits.length % 2 === 1) digits.push(0);
|
|
270
289
|
const out = new Uint8Array(digits.length / 2);
|
|
271
|
-
for (let i = 0; i < out.length; i++) out[i] = digits[i * 2] <<
|
|
290
|
+
for (let i = 0; i < out.length; i++) out[i] = digits[i * 2] << HEX_NIBBLE_BITS | digits[i * 2 + 1];
|
|
272
291
|
return out;
|
|
273
292
|
}
|
|
274
293
|
const RUN_LENGTH_EOD = 128;
|
|
294
|
+
const RUN_LENGTH_REPEAT_COUNT_BASE = 257;
|
|
275
295
|
function runLengthDecode(data) {
|
|
276
296
|
const out = [];
|
|
277
297
|
let i = 0;
|
|
@@ -283,7 +303,7 @@ function runLengthDecode(data) {
|
|
|
283
303
|
const count = length + 1;
|
|
284
304
|
for (let j = 0; j < count && i < data.length; j++, i++) out.push(data[i]);
|
|
285
305
|
} else {
|
|
286
|
-
const count =
|
|
306
|
+
const count = RUN_LENGTH_REPEAT_COUNT_BASE - length;
|
|
287
307
|
const byte = data[i] ?? 0;
|
|
288
308
|
i++;
|
|
289
309
|
for (let j = 0; j < count; j++) out.push(byte);
|
package/dist/filters.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.cjs";
|
|
2
|
-
import { n as PdfDict, r as PdfObject } from "./objects-
|
|
2
|
+
import { n as PdfDict, r as PdfObject } from "./objects-e2RS3-yT.cjs";
|
|
3
3
|
//#region src/filters.d.ts
|
|
4
4
|
interface DecodedStream {
|
|
5
5
|
readonly bytes: Uint8Array<ArrayBuffer>;
|
package/dist/filters.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfDiagnosticSink } from "./diagnostics.js";
|
|
2
|
-
import { n as PdfDict, r as PdfObject } from "./objects-
|
|
2
|
+
import { n as PdfDict, r as PdfObject } from "./objects-e2RS3-yT.js";
|
|
3
3
|
//#region src/filters.d.ts
|
|
4
4
|
interface DecodedStream {
|
|
5
5
|
readonly bytes: Uint8Array<ArrayBuffer>;
|
package/dist/filters.js
CHANGED
|
@@ -5,6 +5,8 @@ import { decodeCcittFax } from "./image/ccitt.js";
|
|
|
5
5
|
import { decodeJbig2Embedded } from "./image/jbig2.js";
|
|
6
6
|
import { applyPredictor, readPredictorParams } from "./predictors.js";
|
|
7
7
|
//#region src/filters.ts
|
|
8
|
+
const BITS_PER_BYTE = 8;
|
|
9
|
+
const BYTE_MASK = 255;
|
|
8
10
|
function decodeStream(raw, dict, sink, resolve) {
|
|
9
11
|
const filters = filterNames(dict);
|
|
10
12
|
const parms = decodeParmsList(dict, filters.length);
|
|
@@ -102,7 +104,7 @@ function jbig2Decode(data, parm, dict, sink, resolve) {
|
|
|
102
104
|
}
|
|
103
105
|
});
|
|
104
106
|
return {
|
|
105
|
-
bytes: Uint8Array.from(image.bytes, (byte) => byte ^
|
|
107
|
+
bytes: Uint8Array.from(image.bytes, (byte) => byte ^ BYTE_MASK),
|
|
106
108
|
globals
|
|
107
109
|
};
|
|
108
110
|
} catch (error) {
|
|
@@ -145,6 +147,9 @@ function decodeParmsList(dict, count) {
|
|
|
145
147
|
const LZW_CLEAR_TABLE = 256;
|
|
146
148
|
const LZW_EOD = 257;
|
|
147
149
|
const LZW_INITIAL_CODE_WIDTH = 9;
|
|
150
|
+
const LZW_CODE_WIDTH_10 = 10;
|
|
151
|
+
const LZW_CODE_WIDTH_11 = 11;
|
|
152
|
+
const LZW_CODE_WIDTH_12 = 12;
|
|
148
153
|
const LZW_FIRST_NEW_CODE = 258;
|
|
149
154
|
function initialLzwDictionary() {
|
|
150
155
|
return Array.from({ length: 256 }, (_, i) => new Uint8Array([i]));
|
|
@@ -168,9 +173,9 @@ function lzwDecode(data, earlyChange, sink) {
|
|
|
168
173
|
const readCode = () => {
|
|
169
174
|
while (bitCount < codeWidth) {
|
|
170
175
|
if (pos >= data.length) return;
|
|
171
|
-
bitBuffer = bitBuffer <<
|
|
176
|
+
bitBuffer = bitBuffer << BITS_PER_BYTE | data[pos];
|
|
172
177
|
pos++;
|
|
173
|
-
bitCount +=
|
|
178
|
+
bitCount += BITS_PER_BYTE;
|
|
174
179
|
}
|
|
175
180
|
const value = bitBuffer >>> bitCount - codeWidth & (1 << codeWidth) - 1;
|
|
176
181
|
bitCount -= codeWidth;
|
|
@@ -202,35 +207,40 @@ function lzwDecode(data, earlyChange, sink) {
|
|
|
202
207
|
if (prevEntry !== void 0) {
|
|
203
208
|
dict[nextCode] = concatTwo(prevEntry, new Uint8Array([entry[0] ?? 0]));
|
|
204
209
|
nextCode++;
|
|
205
|
-
if (nextCode + bias ===
|
|
206
|
-
else if (nextCode + bias ===
|
|
207
|
-
else if (nextCode + bias ===
|
|
210
|
+
if (nextCode + bias === 2 ** LZW_INITIAL_CODE_WIDTH) codeWidth = LZW_CODE_WIDTH_10;
|
|
211
|
+
else if (nextCode + bias === 2 ** LZW_CODE_WIDTH_10) codeWidth = LZW_CODE_WIDTH_11;
|
|
212
|
+
else if (nextCode + bias === 2 ** LZW_CODE_WIDTH_11) codeWidth = LZW_CODE_WIDTH_12;
|
|
208
213
|
}
|
|
209
214
|
prevEntry = entry;
|
|
210
215
|
}
|
|
211
216
|
return Uint8Array.from(out);
|
|
212
217
|
}
|
|
218
|
+
const ASCII85_GROUP_BYTES = 4;
|
|
213
219
|
const ASCII85_ZERO_GROUP_MARKER = 122;
|
|
214
220
|
const ASCII85_END_MARKER = 126;
|
|
215
221
|
const ASCII85_MIN_DIGIT = 33;
|
|
216
222
|
const ASCII85_MAX_DIGIT = 117;
|
|
217
223
|
const ASCII85_MAX_DIGIT_VALUE = 84;
|
|
218
|
-
|
|
224
|
+
const ASCII85_RADIX = 85;
|
|
225
|
+
const ASCII85_GROUP_DIGITS = 5;
|
|
226
|
+
const ASCII85_OPTIONAL_PREFIX_LT = 60;
|
|
227
|
+
const ASCII85_BYTE_3_SHIFT = 24;
|
|
228
|
+
const ASCII85_BYTE_2_SHIFT = 16;
|
|
229
|
+
function ascii85GroupBytes(digits, byteCount) {
|
|
219
230
|
let value = 0;
|
|
220
|
-
for (const digit of digits) value = value *
|
|
221
|
-
|
|
222
|
-
value >>>
|
|
223
|
-
value >>>
|
|
224
|
-
value >>>
|
|
225
|
-
value &
|
|
226
|
-
];
|
|
227
|
-
for (let i = 0; i < byteCount; i++) out.push(bytes[i]);
|
|
231
|
+
for (const digit of digits) value = value * ASCII85_RADIX + digit;
|
|
232
|
+
return [
|
|
233
|
+
value >>> ASCII85_BYTE_3_SHIFT & BYTE_MASK,
|
|
234
|
+
value >>> ASCII85_BYTE_2_SHIFT & BYTE_MASK,
|
|
235
|
+
value >>> BITS_PER_BYTE & BYTE_MASK,
|
|
236
|
+
value & BYTE_MASK
|
|
237
|
+
].slice(0, byteCount);
|
|
228
238
|
}
|
|
229
239
|
function ascii85Decode(data) {
|
|
230
240
|
const out = [];
|
|
231
241
|
let tuple = [];
|
|
232
242
|
let i = 0;
|
|
233
|
-
if (data.length >= 2 && data[0] ===
|
|
243
|
+
if (data.length >= 2 && data[0] === ASCII85_OPTIONAL_PREFIX_LT && data[1] === ASCII85_END_MARKER) i = 2;
|
|
234
244
|
for (; i < data.length; i++) {
|
|
235
245
|
const byte = data[i];
|
|
236
246
|
if (byte === ASCII85_END_MARKER) break;
|
|
@@ -241,36 +251,46 @@ function ascii85Decode(data) {
|
|
|
241
251
|
}
|
|
242
252
|
if (byte < ASCII85_MIN_DIGIT || byte > ASCII85_MAX_DIGIT) continue;
|
|
243
253
|
tuple.push(byte - ASCII85_MIN_DIGIT);
|
|
244
|
-
if (tuple.length ===
|
|
245
|
-
|
|
254
|
+
if (tuple.length === ASCII85_GROUP_DIGITS) {
|
|
255
|
+
out.push(...ascii85GroupBytes(tuple, ASCII85_GROUP_BYTES));
|
|
246
256
|
tuple = [];
|
|
247
257
|
}
|
|
248
258
|
}
|
|
249
259
|
if (tuple.length > 1) {
|
|
250
260
|
const padded = tuple.slice();
|
|
251
|
-
while (padded.length <
|
|
252
|
-
|
|
261
|
+
while (padded.length < ASCII85_GROUP_DIGITS) padded.push(ASCII85_MAX_DIGIT_VALUE);
|
|
262
|
+
out.push(...ascii85GroupBytes(padded, tuple.length - 1));
|
|
253
263
|
}
|
|
254
264
|
return Uint8Array.from(out);
|
|
255
265
|
}
|
|
266
|
+
const ASCII_DIGIT_ZERO = 48;
|
|
267
|
+
const ASCII_DIGIT_NINE = 57;
|
|
268
|
+
const ASCII_UPPER_A = 65;
|
|
269
|
+
const ASCII_UPPER_F = 70;
|
|
270
|
+
const ASCII_LOWER_A = 97;
|
|
271
|
+
const ASCII_LOWER_F = 102;
|
|
272
|
+
const HEX_LETTER_DIGIT_OFFSET = 10;
|
|
273
|
+
const ASCII_HEX_TERMINATOR = 62;
|
|
274
|
+
const HEX_NIBBLE_BITS = 4;
|
|
256
275
|
function hexDigitValue(byte) {
|
|
257
|
-
if (byte >=
|
|
258
|
-
if (byte >=
|
|
259
|
-
if (byte >=
|
|
276
|
+
if (byte >= ASCII_DIGIT_ZERO && byte <= ASCII_DIGIT_NINE) return byte - ASCII_DIGIT_ZERO;
|
|
277
|
+
if (byte >= ASCII_UPPER_A && byte <= ASCII_UPPER_F) return byte - ASCII_UPPER_A + HEX_LETTER_DIGIT_OFFSET;
|
|
278
|
+
if (byte >= ASCII_LOWER_A && byte <= ASCII_LOWER_F) return byte - ASCII_LOWER_A + HEX_LETTER_DIGIT_OFFSET;
|
|
260
279
|
}
|
|
261
280
|
function asciiHexDecode(data) {
|
|
262
281
|
const digits = [];
|
|
263
282
|
for (const byte of data) {
|
|
264
|
-
if (byte ===
|
|
283
|
+
if (byte === ASCII_HEX_TERMINATOR) break;
|
|
265
284
|
const value = hexDigitValue(byte);
|
|
266
285
|
if (value !== void 0) digits.push(value);
|
|
267
286
|
}
|
|
268
287
|
if (digits.length % 2 === 1) digits.push(0);
|
|
269
288
|
const out = new Uint8Array(digits.length / 2);
|
|
270
|
-
for (let i = 0; i < out.length; i++) out[i] = digits[i * 2] <<
|
|
289
|
+
for (let i = 0; i < out.length; i++) out[i] = digits[i * 2] << HEX_NIBBLE_BITS | digits[i * 2 + 1];
|
|
271
290
|
return out;
|
|
272
291
|
}
|
|
273
292
|
const RUN_LENGTH_EOD = 128;
|
|
293
|
+
const RUN_LENGTH_REPEAT_COUNT_BASE = 257;
|
|
274
294
|
function runLengthDecode(data) {
|
|
275
295
|
const out = [];
|
|
276
296
|
let i = 0;
|
|
@@ -282,7 +302,7 @@ function runLengthDecode(data) {
|
|
|
282
302
|
const count = length + 1;
|
|
283
303
|
for (let j = 0; j < count && i < data.length; j++, i++) out.push(data[i]);
|
|
284
304
|
} else {
|
|
285
|
-
const count =
|
|
305
|
+
const count = RUN_LENGTH_REPEAT_COUNT_BASE - length;
|
|
286
306
|
const byte = data[i] ?? 0;
|
|
287
307
|
i++;
|
|
288
308
|
for (let j = 0; j < count; j++) out.push(byte);
|
package/dist/font-face.cjs
CHANGED
|
@@ -9,8 +9,9 @@ var FontFaceParseError = class extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
const SFNT_VERSION_COLLECTION = 1953784678;
|
|
12
|
+
const SFNT_VERSION_TAG_BYTES = 4;
|
|
12
13
|
function isTrueTypeCollection(bytes) {
|
|
13
|
-
return require_sfnt.hasBytes(bytes, 0,
|
|
14
|
+
return require_sfnt.hasBytes(bytes, 0, SFNT_VERSION_TAG_BYTES) && require_sfnt.u32(bytes, 0) === SFNT_VERSION_COLLECTION;
|
|
14
15
|
}
|
|
15
16
|
const OS2_FS_SELECTION_ITALIC = 1;
|
|
16
17
|
const OS2_FS_SELECTION_BOLD = 32;
|
package/dist/font-face.js
CHANGED
|
@@ -8,8 +8,9 @@ var FontFaceParseError = class extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
const SFNT_VERSION_COLLECTION = 1953784678;
|
|
11
|
+
const SFNT_VERSION_TAG_BYTES = 4;
|
|
11
12
|
function isTrueTypeCollection(bytes) {
|
|
12
|
-
return hasBytes(bytes, 0,
|
|
13
|
+
return hasBytes(bytes, 0, SFNT_VERSION_TAG_BYTES) && u32(bytes, 0) === SFNT_VERSION_COLLECTION;
|
|
13
14
|
}
|
|
14
15
|
const OS2_FS_SELECTION_ITALIC = 1;
|
|
15
16
|
const OS2_FS_SELECTION_BOLD = 32;
|
package/dist/font-read.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-BHD2HZIL.cjs");
|
|
3
3
|
const require_objects = require("./objects.cjs");
|
|
4
4
|
const require_filters = require("./filters.cjs");
|
|
5
5
|
const require_builtin_encoding = require("./builtin-encoding.cjs");
|
|
@@ -7,6 +7,7 @@ const require_cmap = require("./cmap.cjs");
|
|
|
7
7
|
const require_fonts = require("./fonts.cjs");
|
|
8
8
|
const require_font_style = require("./font-style.cjs");
|
|
9
9
|
//#region src/font-read.ts
|
|
10
|
+
const BITS_PER_BYTE = 8;
|
|
10
11
|
const SYMBOLIC_FLAG_BIT = 4;
|
|
11
12
|
const ITALIC_FLAG_BIT = 64;
|
|
12
13
|
const FORCE_BOLD_FLAG_BIT = 1 << 18;
|
|
@@ -150,6 +151,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
150
151
|
decodeToUnicode
|
|
151
152
|
};
|
|
152
153
|
}
|
|
154
|
+
const W_RANGE_ENTRY_COUNT = 3;
|
|
153
155
|
function readCidWidths(w) {
|
|
154
156
|
const map = /* @__PURE__ */ new Map();
|
|
155
157
|
if (w === void 0) return map;
|
|
@@ -171,7 +173,7 @@ function readCidWidths(w) {
|
|
|
171
173
|
const last = require_objects.asNumber(next);
|
|
172
174
|
const width = require_objects.asNumber(w[i + 2]);
|
|
173
175
|
if (last !== void 0 && width !== void 0) for (let cid = first; cid <= last; cid++) map.set(cid, width);
|
|
174
|
-
i +=
|
|
176
|
+
i += W_RANGE_ENTRY_COUNT;
|
|
175
177
|
}
|
|
176
178
|
}
|
|
177
179
|
return map;
|
|
@@ -182,6 +184,10 @@ const DEFAULT_VERTICAL_DISPLACEMENT_Y = -1e3;
|
|
|
182
184
|
const DW2_ENTRY_COUNT = 2;
|
|
183
185
|
const W2_TRIPLET_LENGTH = 3;
|
|
184
186
|
const VERTICAL_WRITING_MODE = 1;
|
|
187
|
+
const W2_RANGE_W1Y_OFFSET = 2;
|
|
188
|
+
const W2_RANGE_VX_OFFSET = 3;
|
|
189
|
+
const W2_RANGE_VY_OFFSET = 4;
|
|
190
|
+
const W2_RANGE_ENTRY_COUNT = 5;
|
|
185
191
|
function readCidVerticalMetrics(w2) {
|
|
186
192
|
const map = /* @__PURE__ */ new Map();
|
|
187
193
|
if (w2 === void 0) return map;
|
|
@@ -202,9 +208,9 @@ function readCidVerticalMetrics(w2) {
|
|
|
202
208
|
continue;
|
|
203
209
|
}
|
|
204
210
|
const last = require_objects.asNumber(next);
|
|
205
|
-
const entry = verticalEntryFrom(require_objects.asNumber(w2[i +
|
|
211
|
+
const entry = verticalEntryFrom(require_objects.asNumber(w2[i + W2_RANGE_W1Y_OFFSET]), require_objects.asNumber(w2[i + W2_RANGE_VX_OFFSET]), require_objects.asNumber(w2[i + W2_RANGE_VY_OFFSET]));
|
|
206
212
|
if (last !== void 0 && entry !== void 0) for (let cid = first; cid <= last; cid++) map.set(cid, entry);
|
|
207
|
-
i +=
|
|
213
|
+
i += W2_RANGE_ENTRY_COUNT;
|
|
208
214
|
}
|
|
209
215
|
return map;
|
|
210
216
|
}
|
|
@@ -265,7 +271,7 @@ function buildCompositeFont(fontDict, context) {
|
|
|
265
271
|
let unmapped = 0;
|
|
266
272
|
for (let i = 0; i + 1 < codes.length; i += 2) {
|
|
267
273
|
glyphCount++;
|
|
268
|
-
const cid = (codes[i] ?? 0) <<
|
|
274
|
+
const cid = (codes[i] ?? 0) << BITS_PER_BYTE | (codes[i + 1] ?? 0);
|
|
269
275
|
const mapped = toUnicode?.lookup(cid);
|
|
270
276
|
if (mapped !== void 0) {
|
|
271
277
|
out += mapped;
|
|
@@ -313,7 +319,7 @@ function createFontResolver(context) {
|
|
|
313
319
|
const font = resolve(fontResourceName, resources);
|
|
314
320
|
if (font === void 0) return;
|
|
315
321
|
const byteLengthConsumed = font.composite ? 2 : 1;
|
|
316
|
-
const code = font.composite ? (codes[byteOffset] ?? 0) <<
|
|
322
|
+
const code = font.composite ? (codes[byteOffset] ?? 0) << BITS_PER_BYTE | (codes[byteOffset + 1] ?? 0) : codes[byteOffset] ?? 0;
|
|
317
323
|
const vertical = font.verticalMetricsOf?.(code);
|
|
318
324
|
return {
|
|
319
325
|
widthPer1000: font.widthOf(code),
|
package/dist/font-read.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 { FontMetricsPort, PdfObjectResolver } from "./interpret.cjs";
|
|
4
4
|
//#region src/font-read.d.ts
|
|
5
5
|
interface VerticalGlyphMetrics {
|
package/dist/font-read.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 { FontMetricsPort, PdfObjectResolver } from "./interpret.js";
|
|
4
4
|
//#region src/font-read.d.ts
|
|
5
5
|
interface VerticalGlyphMetrics {
|
package/dist/font-read.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as glyphNameToUnicode, f as symbolGlyphName, m as zapfDingbatsGlyphName, n as widthOfCode, p as winAnsiGlyphName, u as namedEncodingGlyphName } from "./afm-widths-
|
|
1
|
+
import { c as glyphNameToUnicode, f as symbolGlyphName, m as zapfDingbatsGlyphName, n as widthOfCode, p as winAnsiGlyphName, u as namedEncodingGlyphName } from "./afm-widths-B_IGbGky.js";
|
|
2
2
|
import { asArray, asName, asNumber, dictGet, isName } from "./objects.js";
|
|
3
3
|
import { decodeStream } from "./filters.js";
|
|
4
4
|
import { readFontProgramEncoding } from "./builtin-encoding.js";
|
|
@@ -6,6 +6,7 @@ import { parseToUnicodeCMap } from "./cmap.js";
|
|
|
6
6
|
import { resolveStandardFont } from "./fonts.js";
|
|
7
7
|
import { styleFromBaseFontName } from "./font-style.js";
|
|
8
8
|
//#region src/font-read.ts
|
|
9
|
+
const BITS_PER_BYTE = 8;
|
|
9
10
|
const SYMBOLIC_FLAG_BIT = 4;
|
|
10
11
|
const ITALIC_FLAG_BIT = 64;
|
|
11
12
|
const FORCE_BOLD_FLAG_BIT = 1 << 18;
|
|
@@ -149,6 +150,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
149
150
|
decodeToUnicode
|
|
150
151
|
};
|
|
151
152
|
}
|
|
153
|
+
const W_RANGE_ENTRY_COUNT = 3;
|
|
152
154
|
function readCidWidths(w) {
|
|
153
155
|
const map = /* @__PURE__ */ new Map();
|
|
154
156
|
if (w === void 0) return map;
|
|
@@ -170,7 +172,7 @@ function readCidWidths(w) {
|
|
|
170
172
|
const last = asNumber(next);
|
|
171
173
|
const width = asNumber(w[i + 2]);
|
|
172
174
|
if (last !== void 0 && width !== void 0) for (let cid = first; cid <= last; cid++) map.set(cid, width);
|
|
173
|
-
i +=
|
|
175
|
+
i += W_RANGE_ENTRY_COUNT;
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
return map;
|
|
@@ -181,6 +183,10 @@ const DEFAULT_VERTICAL_DISPLACEMENT_Y = -1e3;
|
|
|
181
183
|
const DW2_ENTRY_COUNT = 2;
|
|
182
184
|
const W2_TRIPLET_LENGTH = 3;
|
|
183
185
|
const VERTICAL_WRITING_MODE = 1;
|
|
186
|
+
const W2_RANGE_W1Y_OFFSET = 2;
|
|
187
|
+
const W2_RANGE_VX_OFFSET = 3;
|
|
188
|
+
const W2_RANGE_VY_OFFSET = 4;
|
|
189
|
+
const W2_RANGE_ENTRY_COUNT = 5;
|
|
184
190
|
function readCidVerticalMetrics(w2) {
|
|
185
191
|
const map = /* @__PURE__ */ new Map();
|
|
186
192
|
if (w2 === void 0) return map;
|
|
@@ -201,9 +207,9 @@ function readCidVerticalMetrics(w2) {
|
|
|
201
207
|
continue;
|
|
202
208
|
}
|
|
203
209
|
const last = asNumber(next);
|
|
204
|
-
const entry = verticalEntryFrom(asNumber(w2[i +
|
|
210
|
+
const entry = verticalEntryFrom(asNumber(w2[i + W2_RANGE_W1Y_OFFSET]), asNumber(w2[i + W2_RANGE_VX_OFFSET]), asNumber(w2[i + W2_RANGE_VY_OFFSET]));
|
|
205
211
|
if (last !== void 0 && entry !== void 0) for (let cid = first; cid <= last; cid++) map.set(cid, entry);
|
|
206
|
-
i +=
|
|
212
|
+
i += W2_RANGE_ENTRY_COUNT;
|
|
207
213
|
}
|
|
208
214
|
return map;
|
|
209
215
|
}
|
|
@@ -264,7 +270,7 @@ function buildCompositeFont(fontDict, context) {
|
|
|
264
270
|
let unmapped = 0;
|
|
265
271
|
for (let i = 0; i + 1 < codes.length; i += 2) {
|
|
266
272
|
glyphCount++;
|
|
267
|
-
const cid = (codes[i] ?? 0) <<
|
|
273
|
+
const cid = (codes[i] ?? 0) << BITS_PER_BYTE | (codes[i + 1] ?? 0);
|
|
268
274
|
const mapped = toUnicode?.lookup(cid);
|
|
269
275
|
if (mapped !== void 0) {
|
|
270
276
|
out += mapped;
|
|
@@ -312,7 +318,7 @@ function createFontResolver(context) {
|
|
|
312
318
|
const font = resolve(fontResourceName, resources);
|
|
313
319
|
if (font === void 0) return;
|
|
314
320
|
const byteLengthConsumed = font.composite ? 2 : 1;
|
|
315
|
-
const code = font.composite ? (codes[byteOffset] ?? 0) <<
|
|
321
|
+
const code = font.composite ? (codes[byteOffset] ?? 0) << BITS_PER_BYTE | (codes[byteOffset + 1] ?? 0) : codes[byteOffset] ?? 0;
|
|
316
322
|
const vertical = font.verticalMetricsOf?.(code);
|
|
317
323
|
return {
|
|
318
324
|
widthPer1000: font.widthOf(code),
|
package/dist/font-registry.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as StandardFontName } from "./afm-widths-CneRyu5l.cjs";
|
|
2
|
-
import { t as EmbeddedFace } from "./embedded-font-
|
|
2
|
+
import { t as EmbeddedFace } from "./embedded-font-DgVBedw6.cjs";
|
|
3
3
|
import { FontRegistryOptions, LayoutFont } from "document-schema.js";
|
|
4
4
|
//#region src/font-registry.d.ts
|
|
5
5
|
type ResolvedFace = {
|
|
@@ -11,9 +11,9 @@ type ResolvedFace = {
|
|
|
11
11
|
readonly matched: boolean;
|
|
12
12
|
};
|
|
13
13
|
interface FontRegistry {
|
|
14
|
-
resolve: (font: LayoutFont) => ResolvedFace;
|
|
14
|
+
resolve: (font: Readonly<LayoutFont>) => ResolvedFace;
|
|
15
15
|
}
|
|
16
16
|
declare function createFontRegistry(options?: FontRegistryOptions): FontRegistry;
|
|
17
|
-
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: LayoutFont): ResolvedFace;
|
|
17
|
+
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: Readonly<LayoutFont>): ResolvedFace;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { FontRegistry, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
|
package/dist/font-registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as StandardFontName } from "./afm-widths-CneRyu5l.js";
|
|
2
|
-
import { t as EmbeddedFace } from "./embedded-font-
|
|
2
|
+
import { t as EmbeddedFace } from "./embedded-font-ByD7ZiQS.js";
|
|
3
3
|
import { FontRegistryOptions, LayoutFont } from "document-schema.js";
|
|
4
4
|
//#region src/font-registry.d.ts
|
|
5
5
|
type ResolvedFace = {
|
|
@@ -11,9 +11,9 @@ type ResolvedFace = {
|
|
|
11
11
|
readonly matched: boolean;
|
|
12
12
|
};
|
|
13
13
|
interface FontRegistry {
|
|
14
|
-
resolve: (font: LayoutFont) => ResolvedFace;
|
|
14
|
+
resolve: (font: Readonly<LayoutFont>) => ResolvedFace;
|
|
15
15
|
}
|
|
16
16
|
declare function createFontRegistry(options?: FontRegistryOptions): FontRegistry;
|
|
17
|
-
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: LayoutFont): ResolvedFace;
|
|
17
|
+
declare function resolveFaceWithRegistry(registry: FontRegistry | undefined, font: Readonly<LayoutFont>): ResolvedFace;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { FontRegistry, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
|