pdf-codec 5.7.1 → 5.7.2

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 CHANGED
@@ -334,7 +334,7 @@ Reading a program's built-in encoding is what stops a symbol-encoded subset —
334
334
 
335
335
  ## Grouping text runs into lines and words
336
336
 
337
- `readPdf` reports one positioned run per text-showing operator, split wherever the operator itself opens a gap at least a word space wide between two of its glyphs (a `TJ` adjustment, a character spacing `Tc`, or the two summed, since a producer can set one against the other), and a PDF says nothing about lines or words: a line of prose can arrive as one run, as one run per word, or as one run per glyph, entirely at the producer's discretion. `groupPdfTextRuns` turns those runs back into lines of words, and `pdf-codec/text-group` serves it without the write half or the vendored fonts, alongside `pdf-codec/read`.
337
+ `readPdf` reports one positioned run per text-showing operator, split wherever the operator itself opens a gap at least a word space wide between two of its glyphs (a `TJ` adjustment, a character spacing `Tc`, or the two summed, since a producer can set one against the other) or steps the next glyph back past the start of the one before it (an equation drawn back and forth across its line), so a run's glyphs always advance along the line, and a PDF says nothing about lines or words: a line of prose can arrive as one run, as one run per word, or as one run per glyph, entirely at the producer's discretion. `groupPdfTextRuns` turns those runs back into lines of words, and `pdf-codec/text-group` serves it without the write half or the vendored fonts, alongside `pdf-codec/read`.
338
338
 
339
339
  ```ts
340
340
  import { readPdf } from "pdf-codec/read";
@@ -64,6 +64,17 @@ function readToUnicodeCMap(fontDict, context) {
64
64
  const decoded = require_filters.decodeStream(stream.raw, stream.dict, context.sink);
65
65
  return require_cmap.parseToUnicodeCMap(decoded.bytes, context.sink);
66
66
  }
67
+ /**
68
+ * Reads an array-valued font dictionary entry through the document's resolver, with each of its elements resolved too.
69
+ *
70
+ * ISO 32000-1 7.3.10 lets any array, and any element of one, be an indirect object, and producers do write `/Widths`, `/DescendantFonts` and `/W` that way. Read without resolving, such an entry is a reference rather than an array and reads as absent, so a composite font loses its descendant and every glyph takes the default width.
71
+ * @param value - the entry as the dictionary holds it, a direct array or a reference to one
72
+ * @param context - the font read whose resolver follows references
73
+ * @returns the array with its elements resolved, or undefined when the entry is absent or not an array
74
+ */
75
+ function resolvedArray(value, context) {
76
+ return require_objects.asArray(context.resolver.resolve(value))?.map((item) => context.resolver.resolve(item) ?? item);
77
+ }
67
78
  function buildSimpleFont(fontDict, context) {
68
79
  const baseFont = require_objects.asName(require_objects.dictGet(fontDict, "BaseFont")) ?? "Helvetica";
69
80
  const descriptor = context.resolver.resolveDict(require_objects.dictGet(fontDict, "FontDescriptor"));
@@ -71,7 +82,7 @@ function buildSimpleFont(fontDict, context) {
71
82
  const { baseFamily, bold, italic } = require_font_style.styleFromBaseFontName(baseFont, styleFlags);
72
83
  const symbolic = styleFlags.symbolic ?? false;
73
84
  const builtinGlyphName = builtinSymbolGlyphNameLookup(baseFamily);
74
- const widthsArr = require_objects.asArray(require_objects.dictGet(fontDict, "Widths"));
85
+ const widthsArr = resolvedArray(require_objects.dictGet(fontDict, "Widths"), context);
75
86
  const firstChar = require_objects.asNumber(require_objects.dictGet(fontDict, "FirstChar")) ?? 0;
76
87
  const missingWidth = (descriptor !== void 0 ? require_objects.asNumber(require_objects.dictGet(descriptor, "MissingWidth")) : void 0) ?? 0;
77
88
  let widthOf;
@@ -108,7 +119,7 @@ function buildSimpleFont(fontDict, context) {
108
119
  severity: "info",
109
120
  message: `base encoding "${baseEncodingName}" has no dedicated table here and is approximated as WinAnsiEncoding`
110
121
  });
111
- const differencesMap = readDifferencesMap(encodingDict !== void 0 ? require_objects.asArray(require_objects.dictGet(encodingDict, "Differences")) : void 0);
122
+ const differencesMap = readDifferencesMap(encodingDict !== void 0 ? resolvedArray(require_objects.dictGet(encodingDict, "Differences"), context) : void 0);
112
123
  const programEncoding = lazyFontProgram(descriptor, context);
113
124
  const symbolEncoded = symbolic || builtinGlyphName !== void 0;
114
125
  const byGlyphName = (source) => (code) => {
@@ -256,17 +267,17 @@ function readsVertically(fontDict, context) {
256
267
  }
257
268
  function buildCompositeFont(fontDict, context) {
258
269
  const baseFont = require_objects.asName(require_objects.dictGet(fontDict, "BaseFont")) ?? "Helvetica";
259
- const descendants = require_objects.asArray(require_objects.dictGet(fontDict, "DescendantFonts"));
270
+ const descendants = resolvedArray(require_objects.dictGet(fontDict, "DescendantFonts"), context);
260
271
  const descendantDict = descendants !== void 0 ? context.resolver.resolveDict(descendants[0]) : void 0;
261
272
  const descriptor = descendantDict !== void 0 ? context.resolver.resolveDict(require_objects.dictGet(descendantDict, "FontDescriptor")) : void 0;
262
273
  const { baseFamily, bold, italic } = require_font_style.styleFromBaseFontName(baseFont, styleFlagsFromDescriptor(descriptor));
263
274
  const dw = descendantDict !== void 0 ? require_objects.asNumber(require_objects.dictGet(descendantDict, "DW")) ?? DEFAULT_CID_WIDTH : DEFAULT_CID_WIDTH;
264
- const widthMap = readCidWidths(descendantDict !== void 0 ? require_objects.asArray(require_objects.dictGet(descendantDict, "W")) : void 0);
275
+ const widthMap = readCidWidths(descendantDict !== void 0 ? resolvedArray(require_objects.dictGet(descendantDict, "W"), context) : void 0);
265
276
  const widthOf = (cid) => widthMap.get(cid) ?? dw;
266
- const dw2 = descendantDict !== void 0 ? require_objects.asArray(require_objects.dictGet(descendantDict, "DW2")) : void 0;
277
+ const dw2 = descendantDict !== void 0 ? resolvedArray(require_objects.dictGet(descendantDict, "DW2"), context) : void 0;
267
278
  const defaultPositionY = (dw2?.length === DW2_ENTRY_COUNT ? require_objects.asNumber(dw2[0]) : void 0) ?? DEFAULT_VERTICAL_POSITION_Y;
268
279
  const defaultDisplacementY = (dw2?.length === DW2_ENTRY_COUNT ? require_objects.asNumber(dw2[1]) : void 0) ?? DEFAULT_VERTICAL_DISPLACEMENT_Y;
269
- const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ? require_objects.asArray(require_objects.dictGet(descendantDict, "W2")) : void 0);
280
+ const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ? resolvedArray(require_objects.dictGet(descendantDict, "W2"), context) : void 0);
270
281
  const verticalMetricsOf = (cid) => {
271
282
  const entry = verticalMap.get(cid);
272
283
  return {
package/dist/font-read.js CHANGED
@@ -63,6 +63,17 @@ function readToUnicodeCMap(fontDict, context) {
63
63
  const decoded = decodeStream(stream.raw, stream.dict, context.sink);
64
64
  return parseToUnicodeCMap(decoded.bytes, context.sink);
65
65
  }
66
+ /**
67
+ * Reads an array-valued font dictionary entry through the document's resolver, with each of its elements resolved too.
68
+ *
69
+ * ISO 32000-1 7.3.10 lets any array, and any element of one, be an indirect object, and producers do write `/Widths`, `/DescendantFonts` and `/W` that way. Read without resolving, such an entry is a reference rather than an array and reads as absent, so a composite font loses its descendant and every glyph takes the default width.
70
+ * @param value - the entry as the dictionary holds it, a direct array or a reference to one
71
+ * @param context - the font read whose resolver follows references
72
+ * @returns the array with its elements resolved, or undefined when the entry is absent or not an array
73
+ */
74
+ function resolvedArray(value, context) {
75
+ return asArray(context.resolver.resolve(value))?.map((item) => context.resolver.resolve(item) ?? item);
76
+ }
66
77
  function buildSimpleFont(fontDict, context) {
67
78
  const baseFont = asName(dictGet(fontDict, "BaseFont")) ?? "Helvetica";
68
79
  const descriptor = context.resolver.resolveDict(dictGet(fontDict, "FontDescriptor"));
@@ -70,7 +81,7 @@ function buildSimpleFont(fontDict, context) {
70
81
  const { baseFamily, bold, italic } = styleFromBaseFontName(baseFont, styleFlags);
71
82
  const symbolic = styleFlags.symbolic ?? false;
72
83
  const builtinGlyphName = builtinSymbolGlyphNameLookup(baseFamily);
73
- const widthsArr = asArray(dictGet(fontDict, "Widths"));
84
+ const widthsArr = resolvedArray(dictGet(fontDict, "Widths"), context);
74
85
  const firstChar = asNumber(dictGet(fontDict, "FirstChar")) ?? 0;
75
86
  const missingWidth = (descriptor !== void 0 ? asNumber(dictGet(descriptor, "MissingWidth")) : void 0) ?? 0;
76
87
  let widthOf;
@@ -107,7 +118,7 @@ function buildSimpleFont(fontDict, context) {
107
118
  severity: "info",
108
119
  message: `base encoding "${baseEncodingName}" has no dedicated table here and is approximated as WinAnsiEncoding`
109
120
  });
110
- const differencesMap = readDifferencesMap(encodingDict !== void 0 ? asArray(dictGet(encodingDict, "Differences")) : void 0);
121
+ const differencesMap = readDifferencesMap(encodingDict !== void 0 ? resolvedArray(dictGet(encodingDict, "Differences"), context) : void 0);
111
122
  const programEncoding = lazyFontProgram(descriptor, context);
112
123
  const symbolEncoded = symbolic || builtinGlyphName !== void 0;
113
124
  const byGlyphName = (source) => (code) => {
@@ -255,17 +266,17 @@ function readsVertically(fontDict, context) {
255
266
  }
256
267
  function buildCompositeFont(fontDict, context) {
257
268
  const baseFont = asName(dictGet(fontDict, "BaseFont")) ?? "Helvetica";
258
- const descendants = asArray(dictGet(fontDict, "DescendantFonts"));
269
+ const descendants = resolvedArray(dictGet(fontDict, "DescendantFonts"), context);
259
270
  const descendantDict = descendants !== void 0 ? context.resolver.resolveDict(descendants[0]) : void 0;
260
271
  const descriptor = descendantDict !== void 0 ? context.resolver.resolveDict(dictGet(descendantDict, "FontDescriptor")) : void 0;
261
272
  const { baseFamily, bold, italic } = styleFromBaseFontName(baseFont, styleFlagsFromDescriptor(descriptor));
262
273
  const dw = descendantDict !== void 0 ? asNumber(dictGet(descendantDict, "DW")) ?? DEFAULT_CID_WIDTH : DEFAULT_CID_WIDTH;
263
- const widthMap = readCidWidths(descendantDict !== void 0 ? asArray(dictGet(descendantDict, "W")) : void 0);
274
+ const widthMap = readCidWidths(descendantDict !== void 0 ? resolvedArray(dictGet(descendantDict, "W"), context) : void 0);
264
275
  const widthOf = (cid) => widthMap.get(cid) ?? dw;
265
- const dw2 = descendantDict !== void 0 ? asArray(dictGet(descendantDict, "DW2")) : void 0;
276
+ const dw2 = descendantDict !== void 0 ? resolvedArray(dictGet(descendantDict, "DW2"), context) : void 0;
266
277
  const defaultPositionY = (dw2?.length === DW2_ENTRY_COUNT ? asNumber(dw2[0]) : void 0) ?? DEFAULT_VERTICAL_POSITION_Y;
267
278
  const defaultDisplacementY = (dw2?.length === DW2_ENTRY_COUNT ? asNumber(dw2[1]) : void 0) ?? DEFAULT_VERTICAL_DISPLACEMENT_Y;
268
- const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ? asArray(dictGet(descendantDict, "W2")) : void 0);
279
+ const verticalMap = readCidVerticalMetrics(descendantDict !== void 0 ? resolvedArray(dictGet(descendantDict, "W2"), context) : void 0);
269
280
  const verticalMetricsOf = (cid) => {
270
281
  const entry = verticalMap.get(cid);
271
282
  return {
package/dist/index.cjs CHANGED
@@ -21,7 +21,7 @@ const require_write_skipped_surfaces = require("./write-skipped-surfaces.cjs");
21
21
  const require_write = require("./write.cjs");
22
22
  const require_codec = require("./codec.cjs");
23
23
  const require_font_face = require("./font-face.cjs");
24
- const require_raster = require("./raster-De_zVqCu.cjs");
24
+ const require_raster = require("./raster-2avl8Qpk.cjs");
25
25
  exports.DEFAULT_BASELINE_TOLERANCE_EM = require_text_group.DEFAULT_BASELINE_TOLERANCE_EM;
26
26
  exports.DEFAULT_COLUMN_GAP_EM = require_text_group.DEFAULT_COLUMN_GAP_EM;
27
27
  exports.DEFAULT_VERTICAL_METRIC_POLICY = require_measure.DEFAULT_VERTICAL_METRIC_POLICY;
package/dist/index.js CHANGED
@@ -20,6 +20,6 @@ import { PdfSkippedSurfacesError } from "./write-skipped-surfaces.js";
20
20
  import { PdfPartialDocumentError, writePdf } from "./write.js";
21
21
  import { PdfBytesSchema, pdfCodec } from "./codec.js";
22
22
  import { FontFaceParseError, readFontFace } from "./font-face.js";
23
- import { r as renderPdfPage } from "./raster-DCDcD7no.js";
23
+ import { r as renderPdfPage } from "./raster-dqtea8ku.js";
24
24
  export * from "byte-codec";
25
25
  export { DEFAULT_BASELINE_TOLERANCE_EM, DEFAULT_COLUMN_GAP_EM, DEFAULT_VERTICAL_METRIC_POLICY, DEFAULT_WORD_GAP_EM, FontFaceParseError, Jbig2ParseError, Jbig2UnsupportedError, Jpeg2000ParseError, Jpeg2000UnsupportedError, LAYOUT_FORMAT_VERSION, LayoutAnnotationQuadSchema, LayoutAnnotationSchema, LayoutAttachmentSchema, LayoutDestinationSchema, LayoutDestinationTargetSchema, LayoutDocumentSchema, LayoutDocumentSurfaceSchema, LayoutEllipseSchema, LayoutFormFieldSchema, LayoutFormWidgetSchema, LayoutImageAssetSchema, LayoutImageSchema, LayoutInternalLinkSchema, LayoutItemSchema, LayoutLayerSchema, LayoutLineSchema, LayoutLinkSchema, LayoutOutlineItemSchema, LayoutPageSchema, LayoutPathSchema, LayoutPathSegmentSchema, LayoutRectSchema, LayoutStructureElementSchema, LayoutSubpathSchema, LayoutTextSchema, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, PdfEncryptedError, PdfEncryptionError, PdfPageSelectionError, PdfParseError, PdfPartialDocumentError, PdfPasswordRequiredError, PdfSkippedSurfacesError, STANDARD_METRICS, assembleStretchyGlyph, attachScriptRuns, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, filterScanlines, groupPdfTextRuns, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readPdf, renderPdfPage, resolveFaceWithRegistry, resolveStandardFont, runGapPt, runsShareBaseline, scaleMathStretchConstruction, scriptPositionOf, sourcePageIndex, unfilterScanlines, writePdf };
@@ -237,8 +237,9 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
237
237
  let totalLength = 0;
238
238
  let firstGlyphPosition;
239
239
  let lastWidthEndTm;
240
+ let lastGlyphWidth = 0;
240
241
  let gapSinceLastGlyph = 0;
241
- const gapIsWordWide = () => !vertical && totalLength > 0 && gapSinceLastGlyph >= wordGap;
242
+ const gapEndsRun = () => !vertical && totalLength > 0 && (gapSinceLastGlyph >= wordGap || gapSinceLastGlyph < -lastGlyphWidth);
242
243
  const flushRun = () => {
243
244
  if (totalLength === 0) return;
244
245
  const combined = new Uint8Array(totalLength);
@@ -247,7 +248,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
247
248
  combined.set(chunk, at);
248
249
  at += chunk.length;
249
250
  }
250
- const endMatrix = computeTrm(gs, gapIsWordWide() && lastWidthEndTm !== void 0 ? {
251
+ const endMatrix = computeTrm(gs, gapEndsRun() && lastWidthEndTm !== void 0 ? {
251
252
  ...text,
252
253
  tm: lastWidthEndTm
253
254
  } : text);
@@ -270,7 +271,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
270
271
  for (const el of elements) if (el.kind === "string") {
271
272
  let offset = 0;
272
273
  while (offset < el.bytes.length) {
273
- if (gapIsWordWide()) flushRun();
274
+ if (gapEndsRun()) flushRun();
274
275
  if (totalLength === 0) startMatrix = computeTrm(gs, text);
275
276
  firstGlyphPosition ??= vertical ? positionVectorOf(el.bytes.subarray(offset)) : void 0;
276
277
  const glyph = advanceThroughGlyph(fontResourceName, el.bytes, offset);
@@ -278,6 +279,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
278
279
  totalLength += glyph.byteLength;
279
280
  offset += glyph.byteLength;
280
281
  lastWidthEndTm = glyph.widthEndTm;
282
+ lastGlyphWidth = glyph.widthAdvance;
281
283
  gapSinceLastGlyph = glyph.charSpaceAfter;
282
284
  }
283
285
  } else if (el.kind === "number") {
@@ -237,8 +237,9 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
237
237
  let totalLength = 0;
238
238
  let firstGlyphPosition;
239
239
  let lastWidthEndTm;
240
+ let lastGlyphWidth = 0;
240
241
  let gapSinceLastGlyph = 0;
241
- const gapIsWordWide = () => !vertical && totalLength > 0 && gapSinceLastGlyph >= wordGap;
242
+ const gapEndsRun = () => !vertical && totalLength > 0 && (gapSinceLastGlyph >= wordGap || gapSinceLastGlyph < -lastGlyphWidth);
242
243
  const flushRun = () => {
243
244
  if (totalLength === 0) return;
244
245
  const combined = new Uint8Array(totalLength);
@@ -247,7 +248,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
247
248
  combined.set(chunk, at);
248
249
  at += chunk.length;
249
250
  }
250
- const endMatrix = require_interpret_state.computeTrm(gs, gapIsWordWide() && lastWidthEndTm !== void 0 ? {
251
+ const endMatrix = require_interpret_state.computeTrm(gs, gapEndsRun() && lastWidthEndTm !== void 0 ? {
251
252
  ...text,
252
253
  tm: lastWidthEndTm
253
254
  } : text);
@@ -270,7 +271,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
270
271
  for (const el of elements) if (el.kind === "string") {
271
272
  let offset = 0;
272
273
  while (offset < el.bytes.length) {
273
- if (gapIsWordWide()) flushRun();
274
+ if (gapEndsRun()) flushRun();
274
275
  if (totalLength === 0) startMatrix = require_interpret_state.computeTrm(gs, text);
275
276
  firstGlyphPosition ??= vertical ? positionVectorOf(el.bytes.subarray(offset)) : void 0;
276
277
  const glyph = advanceThroughGlyph(fontResourceName, el.bytes, offset);
@@ -278,6 +279,7 @@ function runContentStream(bytes, resources, initialState, context, depth, marked
278
279
  totalLength += glyph.byteLength;
279
280
  offset += glyph.byteLength;
280
281
  lastWidthEndTm = glyph.widthEndTm;
282
+ lastGlyphWidth = glyph.widthAdvance;
281
283
  gapSinceLastGlyph = glyph.charSpaceAfter;
282
284
  }
283
285
  } else if (el.kind === "number") {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_interpret = require("./interpret-BkDxq0QA.cjs");
2
+ const require_interpret = require("./interpret-EqQSNqHD.cjs");
3
3
  exports.cmykColor = require_interpret.cmykColor;
4
4
  exports.genericColor = require_interpret.genericColor;
5
5
  exports.grayColor = require_interpret.grayColor;
@@ -1,2 +1,2 @@
1
- import { a as grayColor, i as genericColor, o as rgbColor, r as cmykColor } from "./interpret-BtzX-LWm.js";
1
+ import { a as grayColor, i as genericColor, o as rgbColor, r as cmykColor } from "./interpret-DI8JCCEE.js";
2
2
  export { cmykColor, genericColor, grayColor, rgbColor };
@@ -53,6 +53,7 @@ function stepPastGlyph(gs, tm, glyph, codes, offset) {
53
53
  byteLength,
54
54
  tm: require_matrix.multiplyMatrices(along(widthAdvance + spacing), tm),
55
55
  widthEndTm: require_matrix.multiplyMatrices(along(widthAdvance), tm),
56
+ widthAdvance,
56
57
  charSpaceAfter: gs.charSpace
57
58
  };
58
59
  }
@@ -34,6 +34,8 @@ interface GlyphStep {
34
34
  readonly tm: Matrix;
35
35
  /** The text matrix at the end of the glyph's own advance width, before any spacing. */
36
36
  readonly widthEndTm: Matrix;
37
+ /** The glyph's own advance width in unscaled text space units, along the direction the font is set in. */
38
+ readonly widthAdvance: number;
37
39
  /** The character spacing added after the glyph's width, in unscaled text space units. The word spacing a single-byte space takes is not counted: the space character already records that word boundary in the run's text. */
38
40
  readonly charSpaceAfter: number;
39
41
  }
@@ -34,6 +34,8 @@ interface GlyphStep {
34
34
  readonly tm: Matrix;
35
35
  /** The text matrix at the end of the glyph's own advance width, before any spacing. */
36
36
  readonly widthEndTm: Matrix;
37
+ /** The glyph's own advance width in unscaled text space units, along the direction the font is set in. */
38
+ readonly widthAdvance: number;
37
39
  /** The character spacing added after the glyph's width, in unscaled text space units. The word spacing a single-byte space takes is not counted: the space character already records that word boundary in the run's text. */
38
40
  readonly charSpaceAfter: number;
39
41
  }
@@ -52,6 +52,7 @@ function stepPastGlyph(gs, tm, glyph, codes, offset) {
52
52
  byteLength,
53
53
  tm: multiplyMatrices(along(widthAdvance + spacing), tm),
54
54
  widthEndTm: multiplyMatrices(along(widthAdvance), tm),
55
+ widthAdvance,
55
56
  charSpaceAfter: gs.charSpace
56
57
  };
57
58
  }
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_interpret = require("./interpret-BkDxq0QA.cjs");
2
+ const require_interpret = require("./interpret-EqQSNqHD.cjs");
3
3
  exports.interpretContentStream = require_interpret.interpretContentStream;
4
4
  exports.numAt = require_interpret.numAt;
package/dist/interpret.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as numAt, t as interpretContentStream } from "./interpret-BtzX-LWm.js";
1
+ import { n as numAt, t as interpretContentStream } from "./interpret-DI8JCCEE.js";
2
2
  export { interpretContentStream, numAt };
@@ -11,7 +11,7 @@ const require_diagnostics = require("./diagnostics.cjs");
11
11
  const require_document = require("./document.cjs");
12
12
  const require_util_abort = require("./util/abort.cjs");
13
13
  const require_font_read = require("./font-read.cjs");
14
- const require_interpret = require("./interpret-BkDxq0QA.cjs");
14
+ const require_interpret = require("./interpret-EqQSNqHD.cjs");
15
15
  const require_read = require("./read.cjs");
16
16
  const require_glyf = require("./glyf.cjs");
17
17
  const require_glyf_contours = require("./glyf-contours.cjs");
@@ -77,7 +77,7 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
77
77
  if (subtype === "Type0") {
78
78
  const encoding = resolver.resolve(require_objects.dictGet(fontDict, "Encoding"));
79
79
  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)");
80
- const descendants = require_objects.asArray(require_objects.dictGet(fontDict, "DescendantFonts"));
80
+ const descendants = require_objects.asArray(resolver.resolve(require_objects.dictGet(fontDict, "DescendantFonts")));
81
81
  const descendant = descendants !== void 0 ? resolver.resolveDict(descendants[0]) : void 0;
82
82
  if (descendant === void 0) return unavailable("a Type0 font with no readable /DescendantFonts entry");
83
83
  const descendantSubtype = require_objects.asName(require_objects.dictGet(descendant, "Subtype"));
@@ -11,7 +11,7 @@ import { NOOP_DIAGNOSTIC_SINK, PdfParseError } from "./diagnostics.js";
11
11
  import { openPdfDocument } from "./document.js";
12
12
  import { throwIfAborted } from "./util/abort.js";
13
13
  import { createFontResolver } from "./font-read.js";
14
- import { t as interpretContentStream } from "./interpret-BtzX-LWm.js";
14
+ import { t as interpretContentStream } from "./interpret-DI8JCCEE.js";
15
15
  import { normalizeRotation, pageRotationTransform } from "./read.js";
16
16
  import { parseGlyf } from "./glyf.js";
17
17
  import { decodeGlyphOutline } from "./glyf-contours.js";
@@ -77,7 +77,7 @@ function buildTextOutlineFace(fontDict, resolver, fontResolver, fontResourceName
77
77
  if (subtype === "Type0") {
78
78
  const encoding = resolver.resolve(dictGet(fontDict, "Encoding"));
79
79
  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)");
80
- const descendants = asArray(dictGet(fontDict, "DescendantFonts"));
80
+ const descendants = asArray(resolver.resolve(dictGet(fontDict, "DescendantFonts")));
81
81
  const descendant = descendants !== void 0 ? resolver.resolveDict(descendants[0]) : void 0;
82
82
  if (descendant === void 0) return unavailable("a Type0 font with no readable /DescendantFonts entry");
83
83
  const descendantSubtype = asName(dictGet(descendant, "Subtype"));
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_raster = require("./raster-De_zVqCu.cjs");
2
+ const require_raster = require("./raster-2avl8Qpk.cjs");
3
3
  exports.drawGlyphOutline = require_raster.drawGlyphOutline;
4
4
  exports.drawTextRun = require_raster.drawTextRun;
5
5
  exports.glyphOutlineSubpaths = require_raster.glyphOutlineSubpaths;
@@ -1,2 +1,2 @@
1
- import { a as drawTextRun, i as drawGlyphOutline, o as glyphOutlineSubpaths } from "./raster-DCDcD7no.js";
1
+ import { a as drawTextRun, i as drawGlyphOutline, o as glyphOutlineSubpaths } from "./raster-dqtea8ku.js";
2
2
  export { drawGlyphOutline, drawTextRun, glyphOutlineSubpaths };
package/dist/raster.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_raster = require("./raster-De_zVqCu.cjs");
2
+ const require_raster = require("./raster-2avl8Qpk.cjs");
3
3
  exports.EXTENT_ZERO_EPSILON = require_raster.EXTENT_ZERO_EPSILON;
4
4
  exports.flattenCubic = require_raster.flattenCubic;
5
5
  exports.renderPdfPage = require_raster.renderPdfPage;
package/dist/raster.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as flattenCubic, r as renderPdfPage, t as EXTENT_ZERO_EPSILON } from "./raster-DCDcD7no.js";
1
+ import { n as flattenCubic, r as renderPdfPage, t as EXTENT_ZERO_EPSILON } from "./raster-dqtea8ku.js";
2
2
  export { EXTENT_ZERO_EPSILON, flattenCubic, renderPdfPage };
package/dist/read.cjs CHANGED
@@ -17,7 +17,7 @@ const require_diagnostics = require("./diagnostics.cjs");
17
17
  const require_document = require("./document.cjs");
18
18
  const require_util_abort = require("./util/abort.cjs");
19
19
  const require_font_read = require("./font-read.cjs");
20
- const require_interpret = require("./interpret-BkDxq0QA.cjs");
20
+ const require_interpret = require("./interpret-EqQSNqHD.cjs");
21
21
  const require_navigation = require("./navigation.cjs");
22
22
  //#region src/read.ts
23
23
  function skippedSurfacesOf(surfaces) {
package/dist/read.js CHANGED
@@ -16,7 +16,7 @@ import { NOOP_DIAGNOSTIC_SINK, PdfPageSelectionError, PdfParseError } from "./di
16
16
  import { openPdfDocument } from "./document.js";
17
17
  import { throwIfAborted } from "./util/abort.js";
18
18
  import { createFontResolver } from "./font-read.js";
19
- import { t as interpretContentStream } from "./interpret-BtzX-LWm.js";
19
+ import { t as interpretContentStream } from "./interpret-DI8JCCEE.js";
20
20
  import { createDestinationRegistry, readOutline } from "./navigation.js";
21
21
  //#region src/read.ts
22
22
  function skippedSurfacesOf(surfaces) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-codec",
3
- "version": "5.7.1",
3
+ "version": "5.7.2",
4
4
  "description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on its own codec-owned LayoutDocument item model and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {