pdf-codec 1.11.10 → 2.0.0

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.
Files changed (40) hide show
  1. package/README.md +3 -4
  2. package/dist/content-write.d.cts +2 -2
  3. package/dist/content-write.d.ts +2 -2
  4. package/dist/{font-registry-B5qL0Vi0.d.cts → font-registry-CpVgwmD0.d.cts} +1 -20
  5. package/dist/{font-registry-mgdbNP8_.d.ts → font-registry-DtxRuSlj.d.ts} +1 -20
  6. package/dist/font-registry.d.cts +2 -2
  7. package/dist/font-registry.d.ts +2 -2
  8. package/dist/formula.d.cts +2 -10
  9. package/dist/formula.d.ts +2 -10
  10. package/dist/index.cjs +0 -4
  11. package/dist/index.d.cts +7 -7
  12. package/dist/index.d.ts +7 -7
  13. package/dist/index.js +1 -3
  14. package/dist/interpret.d.cts +1 -1
  15. package/dist/interpret.d.ts +1 -1
  16. package/dist/math-font.d.cts +2 -2
  17. package/dist/math-font.d.ts +2 -2
  18. package/dist/{math-stretch-DXWjs8gL.d.cts → math-stretch-E26z6byT.d.cts} +2 -2
  19. package/dist/{math-stretch-Bwk_bxh1.d.ts → math-stretch-a_rHNRvc.d.ts} +2 -2
  20. package/dist/math-stretch.d.cts +2 -2
  21. package/dist/math-stretch.d.ts +2 -2
  22. package/dist/{matrix-BHzJESll.d.cts → matrix-CC7OdJhv.d.cts} +1 -4
  23. package/dist/{matrix-BHzJESll.d.ts → matrix-CC7OdJhv.d.ts} +1 -4
  24. package/dist/matrix.d.cts +2 -2
  25. package/dist/matrix.d.ts +2 -2
  26. package/dist/measure.d.cts +3 -15
  27. package/dist/measure.d.ts +3 -15
  28. package/dist/read.d.cts +1 -1
  29. package/dist/read.d.ts +1 -1
  30. package/dist/text-layout.d.cts +2 -33
  31. package/dist/text-layout.d.ts +2 -33
  32. package/dist/write.d.cts +1 -1
  33. package/dist/write.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/dist/math-types-BZkWO5Ow.d.cts +0 -110
  36. package/dist/math-types-Bq7tyV4g.d.ts +0 -110
  37. package/dist/math-types.cjs +0 -0
  38. package/dist/math-types.d.cts +0 -3
  39. package/dist/math-types.d.ts +0 -3
  40. package/dist/math-types.js +0 -0
package/README.md CHANGED
@@ -125,20 +125,19 @@ The one thing a glyph ID cannot carry is meaning: an unencoded glyph gets no ToU
125
125
 
126
126
  `MathFontMetrics.stretch` is the layout-facing form of all this, and the one a layout engine actually calls: it resolves a construction at a target size and additionally **measures** it — `inkAscentPt`/`inkDescentPt` are the whole construction's real ink extent about its drawing origin, taken from actual glyph outlines. Without that a caller cannot place the result, since a construction's ink neither starts at its drawing origin (a large parenthesis variant straddles the baseline) nor is bounded by its advance-derived `size`.
127
127
 
128
- Building a layout engine on top of this codec (this is what `documents.js`'s own `src/layout/` does for docx/pptx/odt/odp/ods/odg): `TextMeasurer`/`createStandardFontMeasurer` and `wrapRunsToWidth` answer "how wide does this text render, and where does this line break" against the standard-14 metrics; `resolveStandardFont`/`STANDARD_METRICS` map an arbitrary requested family/weight/style onto one of the 14 standard PDF faces and that face's own AFM-derived metrics; `rotatePointAboutCenter` handles shape-rotation placement math. None of these do any PDF I/O themselves they're the same primitives `writePdf`/`readPdf` use internally, exported so a caller assembling its own `LayoutDocument` (from any source format) can measure and wrap text identically to how this package will actually render it.
128
+ Building a layout engine on top of this codec (this is what `documents.js`'s own `src/layout/` does for docx/pptx/odt/odp/ods/odg): `TextMeasurer`/`createStandardFontMeasurer` answer "how wide does this text render, and where does this line break" against the standard-14 metrics; `resolveStandardFont`/`STANDARD_METRICS` map an arbitrary requested family/weight/style onto one of the 14 standard PDF faces and that face's own AFM-derived metrics. The text-wrapping primitive (`wrapRunsToWidth`) and the shape-rotation geometry (`rotatePointAboutCenter`) a layout engine also needs now live in documents.js itself (they had no internal pdf-codec caller), so they are no longer exported here; the port types they consume (`TextMeasurer`, `StyledRun`, `WrappedLine`, `ProvidedFont`, the `MathBox`/`MathFontMetrics` family) live in `document-schema.js`, the neutral shared-schema package, so a layout engine never reaches into this backend for its contracts.
129
129
 
130
130
  Embedding real fonts instead of substituting standard-14 faces, via a `FontRegistry` (see `src/font-registry.ts` for the full source-document → caller-supplied → vendored-substitute → standard-14 resolution order). Pass the same registry to both the measurer and `writePdf`, so what was measured and what gets drawn come from one font:
131
131
 
132
132
  ```ts
133
- import { createFontMeasurer, createFontRegistry, wrapRunsToWidth, writePdf } from 'pdf-codec';
133
+ import { createFontMeasurer, createFontRegistry, writePdf } from 'pdf-codec';
134
134
 
135
135
  // With no `fonts`/`sourceFonts` of its own, the registry still maps Calibri onto the vendored,
136
136
  // metric-compatible Carlito face this package embeds (and Cambria onto Caladea).
137
137
  const fonts = createFontRegistry();
138
138
 
139
139
  const measurer = createFontMeasurer(fonts);
140
- const lines = wrapRunsToWidth(runs, measurer, columnWidthPt);
141
- // ... build a LayoutDocument from `lines` ...
140
+ // ... wrap text + build a LayoutDocument using the measurer (documents.js owns wrapRunsToWidth) ...
142
141
  const pdfBytes = writePdf(doc, { fonts, onMissingGlyph: (m) => console.warn('no glyph for', m.from) });
143
142
  ```
144
143
 
@@ -1,6 +1,6 @@
1
1
  import { r as StandardFontName } from "./afm-widths-DyDq56Ph.cjs";
2
2
  import { r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-BU6Jgcof.cjs";
3
- import { TextMeasurer } from "./measure.cjs";
3
+ import { TextMeasurer as TextMeasurer$1 } from "./measure.cjs";
4
4
  import { WinAnsiSubstitution } from "./winansi.cjs";
5
5
  import { LayoutFont, LayoutItem } from "document-schema.js";
6
6
  //#region src/content-write.d.ts
@@ -17,7 +17,7 @@ interface ResolvedImageResource {
17
17
  readonly resourceName: string;
18
18
  }
19
19
  interface ContentWriteContext {
20
- readonly measurer: TextMeasurer;
20
+ readonly measurer: TextMeasurer$1;
21
21
  resolveFont(font: LayoutFont): ResolvedFontResource;
22
22
  resolveImage(imageId: string): ResolvedImageResource;
23
23
  }
@@ -1,6 +1,6 @@
1
1
  import { r as StandardFontName } from "./afm-widths-DyDq56Ph.js";
2
2
  import { r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-fREdbxnr.js";
3
- import { TextMeasurer } from "./measure.js";
3
+ import { TextMeasurer as TextMeasurer$1 } from "./measure.js";
4
4
  import { WinAnsiSubstitution } from "./winansi.js";
5
5
  import { LayoutFont, LayoutItem } from "document-schema.js";
6
6
  //#region src/content-write.d.ts
@@ -17,7 +17,7 @@ interface ResolvedImageResource {
17
17
  readonly resourceName: string;
18
18
  }
19
19
  interface ContentWriteContext {
20
- readonly measurer: TextMeasurer;
20
+ readonly measurer: TextMeasurer$1;
21
21
  resolveFont(font: LayoutFont): ResolvedFontResource;
22
22
  resolveImage(imageId: string): ResolvedImageResource;
23
23
  }
@@ -1,13 +1,7 @@
1
1
  import { r as StandardFontName } from "./afm-widths-DyDq56Ph.cjs";
2
2
  import { t as EmbeddedFace } from "./embedded-font-BU6Jgcof.cjs";
3
- import { LayoutFont } from "document-schema.js";
3
+ import { FontRegistryOptions, FontSubstitution, LayoutFont, ProvidedFont } from "document-schema.js";
4
4
  //#region src/font-registry.d.ts
5
- interface ProvidedFont {
6
- readonly family: string;
7
- readonly bold: boolean;
8
- readonly italic: boolean;
9
- readonly bytes: Uint8Array<ArrayBuffer>;
10
- }
11
5
  type ResolvedFace = {
12
6
  readonly kind: 'embedded';
13
7
  readonly face: EmbeddedFace;
@@ -16,19 +10,6 @@ type ResolvedFace = {
16
10
  readonly standardName: StandardFontName;
17
11
  readonly matched: boolean;
18
12
  };
19
- interface FontSubstitution {
20
- readonly requestedFamily: string;
21
- readonly requestedBold: boolean;
22
- readonly requestedItalic: boolean;
23
- readonly reason: 'missing-face' | 'vendored-substitute';
24
- readonly resolvedFamily: string;
25
- }
26
- interface FontRegistryOptions {
27
- readonly sourceFonts?: readonly ProvidedFont[];
28
- readonly fonts?: readonly ProvidedFont[];
29
- readonly substitutes?: 'vendored' | 'none';
30
- readonly onSubstitution?: (substitution: FontSubstitution) => void;
31
- }
32
13
  interface FontRegistry {
33
14
  resolve(font: LayoutFont): ResolvedFace;
34
15
  }
@@ -1,13 +1,7 @@
1
1
  import { r as StandardFontName } from "./afm-widths-DyDq56Ph.js";
2
2
  import { t as EmbeddedFace } from "./embedded-font-fREdbxnr.js";
3
- import { LayoutFont } from "document-schema.js";
3
+ import { FontRegistryOptions, FontSubstitution, LayoutFont, ProvidedFont } from "document-schema.js";
4
4
  //#region src/font-registry.d.ts
5
- interface ProvidedFont {
6
- readonly family: string;
7
- readonly bold: boolean;
8
- readonly italic: boolean;
9
- readonly bytes: Uint8Array<ArrayBuffer>;
10
- }
11
5
  type ResolvedFace = {
12
6
  readonly kind: 'embedded';
13
7
  readonly face: EmbeddedFace;
@@ -16,19 +10,6 @@ type ResolvedFace = {
16
10
  readonly standardName: StandardFontName;
17
11
  readonly matched: boolean;
18
12
  };
19
- interface FontSubstitution {
20
- readonly requestedFamily: string;
21
- readonly requestedBold: boolean;
22
- readonly requestedItalic: boolean;
23
- readonly reason: 'missing-face' | 'vendored-substitute';
24
- readonly resolvedFamily: string;
25
- }
26
- interface FontRegistryOptions {
27
- readonly sourceFonts?: readonly ProvidedFont[];
28
- readonly fonts?: readonly ProvidedFont[];
29
- readonly substitutes?: 'vendored' | 'none';
30
- readonly onSubstitution?: (substitution: FontSubstitution) => void;
31
- }
32
13
  interface FontRegistry {
33
14
  resolve(font: LayoutFont): ResolvedFace;
34
15
  }
@@ -1,2 +1,2 @@
1
- import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-B5qL0Vi0.cjs";
2
- export { FontRegistry, FontRegistryOptions, FontSubstitution, ProvidedFont, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
1
+ import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-CpVgwmD0.cjs";
2
+ export { FontRegistry, type FontRegistryOptions, type FontSubstitution, type ProvidedFont, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
@@ -1,2 +1,2 @@
1
- import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-mgdbNP8_.js";
2
- export { FontRegistry, FontRegistryOptions, FontSubstitution, ProvidedFont, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
1
+ import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-DtxRuSlj.js";
2
+ export { FontRegistry, type FontRegistryOptions, type FontSubstitution, type ProvidedFont, ResolvedFace, createFontRegistry, resolveFaceWithRegistry };
@@ -1,10 +1,2 @@
1
- import { n as MathBox } from "./math-types-BZkWO5Ow.cjs";
2
- //#region src/formula.d.ts
3
- interface PositionedFormula {
4
- readonly pageIndex: number;
5
- readonly xPt: number;
6
- readonly yPt: number;
7
- readonly box: MathBox;
8
- }
9
- //#endregion
10
- export { PositionedFormula };
1
+ import { MathBox, PositionedFormula } from "document-schema.js";
2
+ export type { MathBox, PositionedFormula };
package/dist/formula.d.ts CHANGED
@@ -1,10 +1,2 @@
1
- import { n as MathBox } from "./math-types-Bq7tyV4g.js";
2
- //#region src/formula.d.ts
3
- interface PositionedFormula {
4
- readonly pageIndex: number;
5
- readonly xPt: number;
6
- readonly yPt: number;
7
- readonly box: MathBox;
8
- }
9
- //#endregion
10
- export { PositionedFormula };
1
+ import { MathBox, PositionedFormula } from "document-schema.js";
2
+ export type { MathBox, PositionedFormula };
package/dist/index.cjs CHANGED
@@ -15,7 +15,6 @@ const require_image_jpeg_info = require("./image/jpeg-info.cjs");
15
15
  const require_image_jpeg2000_errors = require("./image/jpeg2000-errors.cjs");
16
16
  const require_image_jp2_boxes = require("./image/jp2-boxes.cjs");
17
17
  const require_image_jpeg2000 = require("./image/jpeg2000.cjs");
18
- const require_matrix = require("./matrix.cjs");
19
18
  const require_image_png_decode = require("./image/png-decode.cjs");
20
19
  const require_font_registry = require("./font-registry.cjs");
21
20
  const require_math_stretch = require("./math-stretch.cjs");
@@ -25,7 +24,6 @@ const require_write = require("./write.cjs");
25
24
  const require_read = require("./read.cjs");
26
25
  const require_codec = require("./codec.cjs");
27
26
  const require_font_face = require("./font-face.cjs");
28
- const require_text_layout = require("./text-layout.cjs");
29
27
  exports.ByteReader = require_bytes_reader.ByteReader;
30
28
  exports.ByteWriter = require_bytes_writer.ByteWriter;
31
29
  exports.DEFAULT_VERTICAL_METRIC_POLICY = require_measure.DEFAULT_VERTICAL_METRIC_POLICY;
@@ -67,8 +65,6 @@ exports.readJpegInfo = require_image_jpeg_info.readJpegInfo;
67
65
  exports.readPdf = require_read.readPdf;
68
66
  exports.resolveFaceWithRegistry = require_font_registry.resolveFaceWithRegistry;
69
67
  exports.resolveStandardFont = require_fonts.resolveStandardFont;
70
- exports.rotatePointAboutCenter = require_matrix.rotatePointAboutCenter;
71
68
  exports.scaleMathStretchConstruction = require_math_stretch.scaleMathStretchConstruction;
72
69
  exports.unfilterScanlines = require_image_png_filter.unfilterScanlines;
73
- exports.wrapRunsToWidth = require_text_layout.wrapRunsToWidth;
74
70
  exports.writePdf = require_write.writePdf;
package/dist/index.d.cts CHANGED
@@ -7,15 +7,12 @@ import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.cjs";
7
7
  import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.cjs";
8
8
  import { PdfBytesSchema, pdfCodec } from "./codec.cjs";
9
9
  import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-BU6Jgcof.cjs";
10
- import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-B5qL0Vi0.cjs";
10
+ import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-CpVgwmD0.cjs";
11
11
  import { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, TextMeasurer, UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer } from "./measure.cjs";
12
12
  import { WinAnsiSubstitution } from "./winansi.cjs";
13
13
  import { FontFace, FontFaceParseError, readFontFace } from "./font-face.cjs";
14
- import { i as Point, u as rotatePointAboutCenter } from "./matrix-BHzJESll.cjs";
14
+ import { i as Point } from "./matrix-CC7OdJhv.cjs";
15
15
  import { ResolvedFont, resolveStandardFont } from "./fonts.cjs";
16
- import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-gFNB8DmQ.cjs";
17
- import { a as assembleStretchyGlyph, i as MathStretchPlacement, n as MathStretchConstruction, o as scaleMathStretchConstruction, r as MathStretchOptions, t as MathStretchAxis } from "./math-stretch-DXWjs8gL.cjs";
18
- import { a as MathGlyphMetrics, c as MathLayoutItem, d as MathStretchResult, f as MathStroke, i as MathFontMetrics, l as MathRule, n as MathBox, o as MathGlyphPlacement, r as MathColor, s as MathGlyphRun, t as MathAssembledGlyphs, u as MathStretchGlyph } from "./math-types-BZkWO5Ow.cjs";
19
16
  import { PositionedFormula } from "./formula.cjs";
20
17
  import { CcittFaxImage, CcittFaxOptions, decodeCcittFax } from "./image/ccitt.cjs";
21
18
  import { n as Jbig2UnsupportedError, t as Jbig2ParseError } from "./jbig2-errors-Bj6MPxrx.cjs";
@@ -30,6 +27,9 @@ import { PngEncodeOptions, encodePng } from "./image/png-encode.cjs";
30
27
  import { PngFilterType, filterScanlines, unfilterScanlines } from "./image/png-filter.cjs";
31
28
  import { ReadPdfOptions, readPdf } from "./read.cjs";
32
29
  import { WritePdfOptions, writePdf } from "./write.cjs";
30
+ import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-gFNB8DmQ.cjs";
31
+ import { a as scaleMathStretchConstruction, i as assembleStretchyGlyph, n as MathStretchOptions, r as MathStretchPlacement, t as MathStretchConstruction } from "./math-stretch-E26z6byT.cjs";
33
32
  import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.cjs";
34
- import { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth } from "./text-layout.cjs";
35
- export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontFace, FontFaceParseError, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type GlyphInkBounds, type InflateResult, type Jbig2DecodeOptions, type Jbig2Image, Jbig2ParseError, Jbig2UnsupportedError, type Jp2ChannelDefinition, type Jp2ColourSpace, type Jp2Container, type Jp2ImageHeader, type Jpeg2000ComponentMetadata, type Jpeg2000DecodeOptions, type Jpeg2000Image, type Jpeg2000Metadata, Jpeg2000ParseError, type Jpeg2000ProgressionOrder, type Jpeg2000QuantizationStyle, type Jpeg2000Transform, Jpeg2000UnsupportedError, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathAssembledGlyphs, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphAssembly, type MathGlyphConstruction, type MathGlyphMetrics, type MathGlyphPart, type MathGlyphPlacement, type MathGlyphRun, type MathGlyphVariant, type MathLayoutItem, type MathRule, type MathStretchAxis, type MathStretchConstruction, type MathStretchGlyph, type MathStretchOptions, type MathStretchPlacement, type MathStretchResult, type MathStroke, type MathVariants, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type ProvidedFont, type RawImage, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, assembleStretchyGlyph, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, scaleMathStretchConstruction, unfilterScanlines, wrapRunsToWidth, writePdf };
33
+ import { StyledFragment, StyledRun, WrapOptions, WrappedLine } from "./text-layout.cjs";
34
+ import { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke } from "document-schema.js";
35
+ export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontFace, FontFaceParseError, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type GlyphInkBounds, type InflateResult, type Jbig2DecodeOptions, type Jbig2Image, Jbig2ParseError, Jbig2UnsupportedError, type Jp2ChannelDefinition, type Jp2ColourSpace, type Jp2Container, type Jp2ImageHeader, type Jpeg2000ComponentMetadata, type Jpeg2000DecodeOptions, type Jpeg2000Image, type Jpeg2000Metadata, Jpeg2000ParseError, type Jpeg2000ProgressionOrder, type Jpeg2000QuantizationStyle, type Jpeg2000Transform, Jpeg2000UnsupportedError, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathAssembledGlyphs, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphAssembly, type MathGlyphConstruction, type MathGlyphMetrics, type MathGlyphPart, type MathGlyphPlacement, type MathGlyphRun, type MathGlyphVariant, type MathLayoutItem, type MathRule, type MathStretchAxis, type MathStretchConstruction, type MathStretchGlyph, type MathStretchOptions, type MathStretchPlacement, type MathStretchResult, type MathStroke, type MathVariants, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type ProvidedFont, type RawImage, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, assembleStretchyGlyph, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, scaleMathStretchConstruction, unfilterScanlines, writePdf };
package/dist/index.d.ts CHANGED
@@ -7,15 +7,12 @@ import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.js";
7
7
  import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.js";
8
8
  import { PdfBytesSchema, pdfCodec } from "./codec.js";
9
9
  import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-fREdbxnr.js";
10
- import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-mgdbNP8_.js";
10
+ import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-DtxRuSlj.js";
11
11
  import { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, TextMeasurer, UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer } from "./measure.js";
12
12
  import { WinAnsiSubstitution } from "./winansi.js";
13
13
  import { FontFace, FontFaceParseError, readFontFace } from "./font-face.js";
14
- import { i as Point, u as rotatePointAboutCenter } from "./matrix-BHzJESll.js";
14
+ import { i as Point } from "./matrix-CC7OdJhv.js";
15
15
  import { ResolvedFont, resolveStandardFont } from "./fonts.js";
16
- import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-DhPrNoPa.js";
17
- import { a as assembleStretchyGlyph, i as MathStretchPlacement, n as MathStretchConstruction, o as scaleMathStretchConstruction, r as MathStretchOptions, t as MathStretchAxis } from "./math-stretch-Bwk_bxh1.js";
18
- import { a as MathGlyphMetrics, c as MathLayoutItem, d as MathStretchResult, f as MathStroke, i as MathFontMetrics, l as MathRule, n as MathBox, o as MathGlyphPlacement, r as MathColor, s as MathGlyphRun, t as MathAssembledGlyphs, u as MathStretchGlyph } from "./math-types-Bq7tyV4g.js";
19
16
  import { PositionedFormula } from "./formula.js";
20
17
  import { CcittFaxImage, CcittFaxOptions, decodeCcittFax } from "./image/ccitt.js";
21
18
  import { n as Jbig2UnsupportedError, t as Jbig2ParseError } from "./jbig2-errors-Bj6MPxrx.js";
@@ -30,6 +27,9 @@ import { PngEncodeOptions, encodePng } from "./image/png-encode.js";
30
27
  import { PngFilterType, filterScanlines, unfilterScanlines } from "./image/png-filter.js";
31
28
  import { ReadPdfOptions, readPdf } from "./read.js";
32
29
  import { WritePdfOptions, writePdf } from "./write.js";
30
+ import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-DhPrNoPa.js";
31
+ import { a as scaleMathStretchConstruction, i as assembleStretchyGlyph, n as MathStretchOptions, r as MathStretchPlacement, t as MathStretchConstruction } from "./math-stretch-a_rHNRvc.js";
33
32
  import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.js";
34
- import { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth } from "./text-layout.js";
35
- export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontFace, FontFaceParseError, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type GlyphInkBounds, type InflateResult, type Jbig2DecodeOptions, type Jbig2Image, Jbig2ParseError, Jbig2UnsupportedError, type Jp2ChannelDefinition, type Jp2ColourSpace, type Jp2Container, type Jp2ImageHeader, type Jpeg2000ComponentMetadata, type Jpeg2000DecodeOptions, type Jpeg2000Image, type Jpeg2000Metadata, Jpeg2000ParseError, type Jpeg2000ProgressionOrder, type Jpeg2000QuantizationStyle, type Jpeg2000Transform, Jpeg2000UnsupportedError, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathAssembledGlyphs, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphAssembly, type MathGlyphConstruction, type MathGlyphMetrics, type MathGlyphPart, type MathGlyphPlacement, type MathGlyphRun, type MathGlyphVariant, type MathLayoutItem, type MathRule, type MathStretchAxis, type MathStretchConstruction, type MathStretchGlyph, type MathStretchOptions, type MathStretchPlacement, type MathStretchResult, type MathStroke, type MathVariants, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type ProvidedFont, type RawImage, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, assembleStretchyGlyph, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, scaleMathStretchConstruction, unfilterScanlines, wrapRunsToWidth, writePdf };
33
+ import { StyledFragment, StyledRun, WrapOptions, WrappedLine } from "./text-layout.js";
34
+ import { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke } from "document-schema.js";
35
+ export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontFace, FontFaceParseError, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type GlyphInkBounds, type InflateResult, type Jbig2DecodeOptions, type Jbig2Image, Jbig2ParseError, Jbig2UnsupportedError, type Jp2ChannelDefinition, type Jp2ColourSpace, type Jp2Container, type Jp2ImageHeader, type Jpeg2000ComponentMetadata, type Jpeg2000DecodeOptions, type Jpeg2000Image, type Jpeg2000Metadata, Jpeg2000ParseError, type Jpeg2000ProgressionOrder, type Jpeg2000QuantizationStyle, type Jpeg2000Transform, Jpeg2000UnsupportedError, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathAssembledGlyphs, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphAssembly, type MathGlyphConstruction, type MathGlyphMetrics, type MathGlyphPart, type MathGlyphPlacement, type MathGlyphRun, type MathGlyphVariant, type MathLayoutItem, type MathRule, type MathStretchAxis, type MathStretchConstruction, type MathStretchGlyph, type MathStretchOptions, type MathStretchPlacement, type MathStretchResult, type MathStroke, type MathVariants, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type ProvidedFont, type RawImage, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, assembleStretchyGlyph, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, scaleMathStretchConstruction, unfilterScanlines, writePdf };
package/dist/index.js CHANGED
@@ -14,7 +14,6 @@ import { readJpegInfo } from "./image/jpeg-info.js";
14
14
  import { Jpeg2000ParseError, Jpeg2000UnsupportedError } from "./image/jpeg2000-errors.js";
15
15
  import { looksLikeBareCodestream, parseJp2Container } from "./image/jp2-boxes.js";
16
16
  import { decodeJpeg2000, readJpeg2000Metadata } from "./image/jpeg2000.js";
17
- import { rotatePointAboutCenter } from "./matrix.js";
18
17
  import { decodePng } from "./image/png-decode.js";
19
18
  import { createFontRegistry, resolveFaceWithRegistry } from "./font-registry.js";
20
19
  import { assembleStretchyGlyph, scaleMathStretchConstruction } from "./math-stretch.js";
@@ -24,5 +23,4 @@ import { writePdf } from "./write.js";
24
23
  import { readPdf } from "./read.js";
25
24
  import { PdfBytesSchema, pdfCodec } from "./codec.js";
26
25
  import { FontFaceParseError, readFontFace } from "./font-face.js";
27
- import { wrapRunsToWidth } from "./text-layout.js";
28
- export { ByteReader, ByteWriter, DEFAULT_VERTICAL_METRIC_POLICY, FontFaceParseError, Jbig2ParseError, Jbig2UnsupportedError, Jpeg2000ParseError, Jpeg2000UnsupportedError, MAX_INFLATE_OUTPUT_BYTES, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, STANDARD_METRICS, assembleStretchyGlyph, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, scaleMathStretchConstruction, unfilterScanlines, wrapRunsToWidth, writePdf };
26
+ export { ByteReader, ByteWriter, DEFAULT_VERTICAL_METRIC_POLICY, FontFaceParseError, Jbig2ParseError, Jbig2UnsupportedError, Jpeg2000ParseError, Jpeg2000UnsupportedError, MAX_INFLATE_OUTPUT_BYTES, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, STANDARD_METRICS, assembleStretchyGlyph, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodeJbig2Embedded, decodeJpeg2000, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, looksLikeBareCodestream, parseJp2Container, pdfCodec, readFontFace, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, scaleMathStretchConstruction, unfilterScanlines, writePdf };
@@ -1,6 +1,6 @@
1
1
  import { PdfDiagnosticSink } from "./diagnostics.cjs";
2
2
  import { PdfDict, PdfObject } from "./objects.cjs";
3
- import { r as Matrix } from "./matrix-BHzJESll.cjs";
3
+ import { r as Matrix } from "./matrix-CC7OdJhv.cjs";
4
4
  import { Color } from "document-schema.js";
5
5
  //#region src/interpret.d.ts
6
6
  interface ExtractedTextRun {
@@ -1,6 +1,6 @@
1
1
  import { PdfDiagnosticSink } from "./diagnostics.js";
2
2
  import { PdfDict, PdfObject } from "./objects.js";
3
- import { r as Matrix } from "./matrix-BHzJESll.js";
3
+ import { r as Matrix } from "./matrix-CC7OdJhv.js";
4
4
  import { Color } from "document-schema.js";
5
5
  //#region src/interpret.d.ts
6
6
  interface ExtractedTextRun {
@@ -1,7 +1,7 @@
1
1
  import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.cjs";
2
2
  import { r as MathGlyphConstruction } from "./math-table-gFNB8DmQ.cjs";
3
- import { n as MathStretchConstruction, t as MathStretchAxis } from "./math-stretch-DXWjs8gL.cjs";
4
- import { i as MathFontMetrics } from "./math-types-BZkWO5Ow.cjs";
3
+ import { t as MathStretchConstruction } from "./math-stretch-E26z6byT.cjs";
4
+ import { MathFontMetrics, MathStretchAxis } from "document-schema.js";
5
5
  //#region src/math-font.d.ts
6
6
  interface MathFontDescriptorMetrics {
7
7
  readonly unitsPerEm: number;
@@ -1,7 +1,7 @@
1
1
  import { t as GlyphInkBounds } from "./glyph-bounds-BV_Z40KS.js";
2
2
  import { r as MathGlyphConstruction } from "./math-table-DhPrNoPa.js";
3
- import { n as MathStretchConstruction, t as MathStretchAxis } from "./math-stretch-Bwk_bxh1.js";
4
- import { i as MathFontMetrics } from "./math-types-Bq7tyV4g.js";
3
+ import { t as MathStretchConstruction } from "./math-stretch-a_rHNRvc.js";
4
+ import { MathFontMetrics, MathStretchAxis } from "document-schema.js";
5
5
  //#region src/math-font.d.ts
6
6
  interface MathFontDescriptorMetrics {
7
7
  readonly unitsPerEm: number;
@@ -1,6 +1,6 @@
1
1
  import { r as MathGlyphConstruction } from "./math-table-gFNB8DmQ.cjs";
2
+ import { MathStretchAxis } from "document-schema.js";
2
3
  //#region src/math-stretch.d.ts
3
- type MathStretchAxis = 'vertical' | 'horizontal';
4
4
  interface MathStretchPlacement {
5
5
  readonly glyphId: number;
6
6
  readonly offset: number;
@@ -21,4 +21,4 @@ interface MathStretchOptions {
21
21
  declare function assembleStretchyGlyph(construction: MathGlyphConstruction, options: MathStretchOptions): MathStretchConstruction | undefined;
22
22
  declare function scaleMathStretchConstruction(construction: MathStretchConstruction, factor: number): MathStretchConstruction;
23
23
  //#endregion
24
- export { assembleStretchyGlyph as a, MathStretchPlacement as i, MathStretchConstruction as n, scaleMathStretchConstruction as o, MathStretchOptions as r, MathStretchAxis as t };
24
+ export { scaleMathStretchConstruction as a, assembleStretchyGlyph as i, MathStretchOptions as n, MathStretchPlacement as r, MathStretchConstruction as t };
@@ -1,6 +1,6 @@
1
1
  import { r as MathGlyphConstruction } from "./math-table-DhPrNoPa.js";
2
+ import { MathStretchAxis } from "document-schema.js";
2
3
  //#region src/math-stretch.d.ts
3
- type MathStretchAxis = 'vertical' | 'horizontal';
4
4
  interface MathStretchPlacement {
5
5
  readonly glyphId: number;
6
6
  readonly offset: number;
@@ -21,4 +21,4 @@ interface MathStretchOptions {
21
21
  declare function assembleStretchyGlyph(construction: MathGlyphConstruction, options: MathStretchOptions): MathStretchConstruction | undefined;
22
22
  declare function scaleMathStretchConstruction(construction: MathStretchConstruction, factor: number): MathStretchConstruction;
23
23
  //#endregion
24
- export { assembleStretchyGlyph as a, MathStretchPlacement as i, MathStretchConstruction as n, scaleMathStretchConstruction as o, MathStretchOptions as r, MathStretchAxis as t };
24
+ export { scaleMathStretchConstruction as a, assembleStretchyGlyph as i, MathStretchOptions as n, MathStretchPlacement as r, MathStretchConstruction as t };
@@ -1,2 +1,2 @@
1
- import { a as assembleStretchyGlyph, i as MathStretchPlacement, n as MathStretchConstruction, o as scaleMathStretchConstruction, r as MathStretchOptions, t as MathStretchAxis } from "./math-stretch-DXWjs8gL.cjs";
2
- export { MathStretchAxis, MathStretchConstruction, MathStretchOptions, MathStretchPlacement, assembleStretchyGlyph, scaleMathStretchConstruction };
1
+ import { a as scaleMathStretchConstruction, i as assembleStretchyGlyph, n as MathStretchOptions, r as MathStretchPlacement, t as MathStretchConstruction } from "./math-stretch-E26z6byT.cjs";
2
+ export { MathStretchConstruction, MathStretchOptions, MathStretchPlacement, assembleStretchyGlyph, scaleMathStretchConstruction };
@@ -1,2 +1,2 @@
1
- import { a as assembleStretchyGlyph, i as MathStretchPlacement, n as MathStretchConstruction, o as scaleMathStretchConstruction, r as MathStretchOptions, t as MathStretchAxis } from "./math-stretch-Bwk_bxh1.js";
2
- export { MathStretchAxis, MathStretchConstruction, MathStretchOptions, MathStretchPlacement, assembleStretchyGlyph, scaleMathStretchConstruction };
1
+ import { a as scaleMathStretchConstruction, i as assembleStretchyGlyph, n as MathStretchOptions, r as MathStretchPlacement, t as MathStretchConstruction } from "./math-stretch-a_rHNRvc.js";
2
+ export { MathStretchConstruction, MathStretchOptions, MathStretchPlacement, assembleStretchyGlyph, scaleMathStretchConstruction };
@@ -1,11 +1,8 @@
1
+ import { Point } from "document-schema.js";
1
2
  //#region src/matrix.d.ts
2
3
  type Matrix = readonly [number, number, number, number, number, number];
3
4
  declare const IDENTITY_MATRIX: Matrix;
4
5
  declare function multiplyMatrices(m: Matrix, n: Matrix): Matrix;
5
- interface Point {
6
- readonly x: number;
7
- readonly y: number;
8
- }
9
6
  declare function applyMatrix(m: Matrix, point: Point): Point;
10
7
  declare function translationMatrix(x: number, y: number): Matrix;
11
8
  declare function scaleMatrix(sx: number, sy: number): Matrix;
@@ -1,11 +1,8 @@
1
+ import { Point } from "document-schema.js";
1
2
  //#region src/matrix.d.ts
2
3
  type Matrix = readonly [number, number, number, number, number, number];
3
4
  declare const IDENTITY_MATRIX: Matrix;
4
5
  declare function multiplyMatrices(m: Matrix, n: Matrix): Matrix;
5
- interface Point {
6
- readonly x: number;
7
- readonly y: number;
8
- }
9
6
  declare function applyMatrix(m: Matrix, point: Point): Point;
10
7
  declare function translationMatrix(x: number, y: number): Matrix;
11
8
  declare function scaleMatrix(sx: number, sy: number): Matrix;
package/dist/matrix.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as applyMatrix, c as matrixScaleY, d as rotationMatrix, f as scaleMatrix, i as Point, l as multiplyMatrices, n as IDENTITY_MATRIX, o as matrixRotationDegrees, p as translationMatrix, r as Matrix, s as matrixScaleX, t as BEZIER_KAPPA, u as rotatePointAboutCenter } from "./matrix-BHzJESll.cjs";
2
- export { BEZIER_KAPPA, IDENTITY_MATRIX, Matrix, Point, applyMatrix, matrixRotationDegrees, matrixScaleX, matrixScaleY, multiplyMatrices, rotatePointAboutCenter, rotationMatrix, scaleMatrix, translationMatrix };
1
+ import { a as applyMatrix, c as matrixScaleY, d as rotationMatrix, f as scaleMatrix, i as Point, l as multiplyMatrices, n as IDENTITY_MATRIX, o as matrixRotationDegrees, p as translationMatrix, r as Matrix, s as matrixScaleX, t as BEZIER_KAPPA, u as rotatePointAboutCenter } from "./matrix-CC7OdJhv.cjs";
2
+ export { BEZIER_KAPPA, IDENTITY_MATRIX, Matrix, type Point, applyMatrix, matrixRotationDegrees, matrixScaleX, matrixScaleY, multiplyMatrices, rotatePointAboutCenter, rotationMatrix, scaleMatrix, translationMatrix };
package/dist/matrix.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as applyMatrix, c as matrixScaleY, d as rotationMatrix, f as scaleMatrix, i as Point, l as multiplyMatrices, n as IDENTITY_MATRIX, o as matrixRotationDegrees, p as translationMatrix, r as Matrix, s as matrixScaleX, t as BEZIER_KAPPA, u as rotatePointAboutCenter } from "./matrix-BHzJESll.js";
2
- export { BEZIER_KAPPA, IDENTITY_MATRIX, Matrix, Point, applyMatrix, matrixRotationDegrees, matrixScaleX, matrixScaleY, multiplyMatrices, rotatePointAboutCenter, rotationMatrix, scaleMatrix, translationMatrix };
1
+ import { a as applyMatrix, c as matrixScaleY, d as rotationMatrix, f as scaleMatrix, i as Point, l as multiplyMatrices, n as IDENTITY_MATRIX, o as matrixRotationDegrees, p as translationMatrix, r as Matrix, s as matrixScaleX, t as BEZIER_KAPPA, u as rotatePointAboutCenter } from "./matrix-CC7OdJhv.js";
2
+ export { BEZIER_KAPPA, IDENTITY_MATRIX, Matrix, type Point, applyMatrix, matrixRotationDegrees, matrixScaleX, matrixScaleY, multiplyMatrices, rotatePointAboutCenter, rotationMatrix, scaleMatrix, translationMatrix };
@@ -1,18 +1,6 @@
1
- import { t as FontRegistry } from "./font-registry-B5qL0Vi0.cjs";
2
- import { LayoutFont } from "document-schema.js";
1
+ import { t as FontRegistry } from "./font-registry-CpVgwmD0.cjs";
2
+ import { TextMeasurer, UnderlineMetrics } from "document-schema.js";
3
3
  //#region src/measure.d.ts
4
- interface UnderlineMetrics {
5
- readonly offsetPt: number;
6
- readonly thicknessPt: number;
7
- }
8
- interface TextMeasurer {
9
- widthOfTextAtSize(text: string, font: LayoutFont, sizePt: number): number;
10
- lineHeightAtSize(font: LayoutFont, sizePt: number): number;
11
- ascenderAtSize(font: LayoutFont, sizePt: number): number;
12
- descenderAtSize(font: LayoutFont, sizePt: number): number;
13
- underlineAtSize(font: LayoutFont, sizePt: number): UnderlineMetrics;
14
- horizontalScaleFor(font: LayoutFont): number;
15
- }
16
4
  type VerticalMetricPolicy = 'hhea' | 'os2Typo' | 'os2Win';
17
5
  declare const DEFAULT_VERTICAL_METRIC_POLICY: VerticalMetricPolicy;
18
6
  interface StandardFontMeasurerOptions {
@@ -24,4 +12,4 @@ interface FontMeasurerOptions extends StandardFontMeasurerOptions {
24
12
  declare function createFontMeasurer(registry?: FontRegistry, options?: FontMeasurerOptions): TextMeasurer;
25
13
  declare function createStandardFontMeasurer(options?: StandardFontMeasurerOptions): TextMeasurer;
26
14
  //#endregion
27
- export { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, TextMeasurer, UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer };
15
+ export { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, type TextMeasurer, type UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer };
package/dist/measure.d.ts CHANGED
@@ -1,18 +1,6 @@
1
- import { t as FontRegistry } from "./font-registry-mgdbNP8_.js";
2
- import { LayoutFont } from "document-schema.js";
1
+ import { t as FontRegistry } from "./font-registry-DtxRuSlj.js";
2
+ import { TextMeasurer, UnderlineMetrics } from "document-schema.js";
3
3
  //#region src/measure.d.ts
4
- interface UnderlineMetrics {
5
- readonly offsetPt: number;
6
- readonly thicknessPt: number;
7
- }
8
- interface TextMeasurer {
9
- widthOfTextAtSize(text: string, font: LayoutFont, sizePt: number): number;
10
- lineHeightAtSize(font: LayoutFont, sizePt: number): number;
11
- ascenderAtSize(font: LayoutFont, sizePt: number): number;
12
- descenderAtSize(font: LayoutFont, sizePt: number): number;
13
- underlineAtSize(font: LayoutFont, sizePt: number): UnderlineMetrics;
14
- horizontalScaleFor(font: LayoutFont): number;
15
- }
16
4
  type VerticalMetricPolicy = 'hhea' | 'os2Typo' | 'os2Win';
17
5
  declare const DEFAULT_VERTICAL_METRIC_POLICY: VerticalMetricPolicy;
18
6
  interface StandardFontMeasurerOptions {
@@ -24,4 +12,4 @@ interface FontMeasurerOptions extends StandardFontMeasurerOptions {
24
12
  declare function createFontMeasurer(registry?: FontRegistry, options?: FontMeasurerOptions): TextMeasurer;
25
13
  declare function createStandardFontMeasurer(options?: StandardFontMeasurerOptions): TextMeasurer;
26
14
  //#endregion
27
- export { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, TextMeasurer, UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer };
15
+ export { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, type TextMeasurer, type UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer };
package/dist/read.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PdfDiagnosticSink } from "./diagnostics.cjs";
2
- import { r as Matrix } from "./matrix-BHzJESll.cjs";
2
+ import { r as Matrix } from "./matrix-CC7OdJhv.cjs";
3
3
  import { LayoutDocument } from "document-schema.js";
4
4
  //#region src/read.d.ts
5
5
  interface ReadPdfOptions {
package/dist/read.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PdfDiagnosticSink } from "./diagnostics.js";
2
- import { r as Matrix } from "./matrix-BHzJESll.js";
2
+ import { r as Matrix } from "./matrix-CC7OdJhv.js";
3
3
  import { LayoutDocument } from "document-schema.js";
4
4
  //#region src/read.d.ts
5
5
  interface ReadPdfOptions {
@@ -1,37 +1,6 @@
1
- import { TextMeasurer } from "./measure.cjs";
2
- import { Color, LayoutFont } from "document-schema.js";
1
+ import { Color, LayoutFont, StyledFragment, StyledRun, TextMeasurer, WrapOptions, WrappedLine } from "document-schema.js";
3
2
  //#region src/text-layout.d.ts
4
- interface StyledRun {
5
- readonly text: string;
6
- readonly font: LayoutFont;
7
- readonly sizePt: number;
8
- readonly color: Color;
9
- readonly underline?: boolean;
10
- readonly hyperlink?: string;
11
- readonly sourcePath?: string;
12
- }
13
- interface StyledFragment {
14
- readonly text: string;
15
- readonly font: LayoutFont;
16
- readonly sizePt: number;
17
- readonly color: Color;
18
- readonly underline?: boolean;
19
- readonly hyperlink?: string;
20
- readonly sourcePath?: string;
21
- }
22
- interface WrappedLine {
23
- readonly fragments: readonly (StyledFragment & {
24
- readonly xOffsetPt: number;
25
- })[];
26
- readonly widthPt: number;
27
- readonly maxSizePt: number;
28
- readonly ascentPt: number;
29
- readonly descentPt: number;
30
- }
31
- interface WrapOptions {
32
- readonly breakLongWords?: boolean;
33
- }
34
3
  declare function wrapRunsToWidth(runs: readonly StyledRun[], measurer: TextMeasurer, maxWidthPt: number, options?: WrapOptions): WrappedLine[];
35
4
  declare function wrapTextToWidth(text: string, font: LayoutFont, sizePt: number, color: Color, measurer: TextMeasurer, maxWidthPt: number): string[];
36
5
  //#endregion
37
- export { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth, wrapTextToWidth };
6
+ export { type StyledFragment, type StyledRun, type WrapOptions, type WrappedLine, wrapRunsToWidth, wrapTextToWidth };
@@ -1,37 +1,6 @@
1
- import { TextMeasurer } from "./measure.js";
2
- import { Color, LayoutFont } from "document-schema.js";
1
+ import { Color, LayoutFont, StyledFragment, StyledRun, TextMeasurer, WrapOptions, WrappedLine } from "document-schema.js";
3
2
  //#region src/text-layout.d.ts
4
- interface StyledRun {
5
- readonly text: string;
6
- readonly font: LayoutFont;
7
- readonly sizePt: number;
8
- readonly color: Color;
9
- readonly underline?: boolean;
10
- readonly hyperlink?: string;
11
- readonly sourcePath?: string;
12
- }
13
- interface StyledFragment {
14
- readonly text: string;
15
- readonly font: LayoutFont;
16
- readonly sizePt: number;
17
- readonly color: Color;
18
- readonly underline?: boolean;
19
- readonly hyperlink?: string;
20
- readonly sourcePath?: string;
21
- }
22
- interface WrappedLine {
23
- readonly fragments: readonly (StyledFragment & {
24
- readonly xOffsetPt: number;
25
- })[];
26
- readonly widthPt: number;
27
- readonly maxSizePt: number;
28
- readonly ascentPt: number;
29
- readonly descentPt: number;
30
- }
31
- interface WrapOptions {
32
- readonly breakLongWords?: boolean;
33
- }
34
3
  declare function wrapRunsToWidth(runs: readonly StyledRun[], measurer: TextMeasurer, maxWidthPt: number, options?: WrapOptions): WrappedLine[];
35
4
  declare function wrapTextToWidth(text: string, font: LayoutFont, sizePt: number, color: Color, measurer: TextMeasurer, maxWidthPt: number): string[];
36
5
  //#endregion
37
- export { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth, wrapTextToWidth };
6
+ export { type StyledFragment, type StyledRun, type WrapOptions, type WrappedLine, wrapRunsToWidth, wrapTextToWidth };
package/dist/write.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as EmbeddedFaceSubstitution } from "./embedded-font-BU6Jgcof.cjs";
2
- import { t as FontRegistry } from "./font-registry-B5qL0Vi0.cjs";
2
+ import { t as FontRegistry } from "./font-registry-CpVgwmD0.cjs";
3
3
  import { WinAnsiSubstitution } from "./winansi.cjs";
4
4
  import { PositionedFormula } from "./formula.cjs";
5
5
  import { LayoutDocument } from "document-schema.js";
package/dist/write.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as EmbeddedFaceSubstitution } from "./embedded-font-fREdbxnr.js";
2
- import { t as FontRegistry } from "./font-registry-mgdbNP8_.js";
2
+ import { t as FontRegistry } from "./font-registry-DtxRuSlj.js";
3
3
  import { WinAnsiSubstitution } from "./winansi.js";
4
4
  import { PositionedFormula } from "./formula.js";
5
5
  import { LayoutDocument } from "document-schema.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-codec",
3
- "version": "1.11.10",
3
+ "version": "2.0.0",
4
4
  "description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on document-schema.js's LayoutDocument pivot and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,110 +0,0 @@
1
- import { t as MathStretchAxis } from "./math-stretch-DXWjs8gL.cjs";
2
- //#region src/math-types.d.ts
3
- interface MathColor {
4
- readonly r: number;
5
- readonly g: number;
6
- readonly b: number;
7
- }
8
- interface MathGlyphRun {
9
- readonly kind: 'glyphs';
10
- readonly xPt: number;
11
- readonly yPt: number;
12
- readonly text: string;
13
- readonly sizePt: number;
14
- readonly color: MathColor;
15
- }
16
- interface MathRule {
17
- readonly kind: 'rule';
18
- readonly xPt: number;
19
- readonly yPt: number;
20
- readonly widthPt: number;
21
- readonly heightPt: number;
22
- readonly color: MathColor;
23
- }
24
- interface MathStroke {
25
- readonly kind: 'stroke';
26
- readonly points: readonly {
27
- readonly xPt: number;
28
- readonly yPt: number;
29
- }[];
30
- readonly widthPt: number;
31
- readonly color: MathColor;
32
- }
33
- interface MathGlyphPlacement {
34
- readonly glyphId: number;
35
- readonly xPt: number;
36
- readonly yPt: number;
37
- }
38
- interface MathAssembledGlyphs {
39
- readonly kind: 'assembled-glyphs';
40
- readonly placements: readonly MathGlyphPlacement[];
41
- readonly text: string;
42
- readonly sizePt: number;
43
- readonly color: MathColor;
44
- }
45
- type MathLayoutItem = MathGlyphRun | MathRule | MathStroke | MathAssembledGlyphs;
46
- interface MathBox {
47
- readonly widthPt: number;
48
- readonly heightPt: number;
49
- readonly ascentPt: number;
50
- readonly descentPt: number;
51
- readonly items: readonly MathLayoutItem[];
52
- }
53
- interface MathGlyphMetrics {
54
- readonly advanceWidthPt: number;
55
- readonly italicCorrectionPt: number;
56
- readonly topAccentXPt?: number;
57
- readonly inkAscentPt?: number;
58
- readonly inkDescentPt?: number;
59
- }
60
- interface MathStretchGlyph {
61
- readonly glyphId: number;
62
- readonly offsetPt: number;
63
- }
64
- interface MathStretchResult {
65
- readonly kind: 'base' | 'variant' | 'assembly';
66
- readonly sizePt: number;
67
- readonly advanceWidthPt: number;
68
- readonly inkAscentPt: number;
69
- readonly inkDescentPt: number;
70
- readonly placements: readonly MathStretchGlyph[];
71
- }
72
- interface MathFontMetrics {
73
- readonly ascentPerEm: number;
74
- readonly descentPerEm: number;
75
- readonly axisHeightPt: number;
76
- readonly fractionRuleThicknessPt: number;
77
- readonly fractionNumeratorShiftUpPt: number;
78
- readonly fractionNumeratorDisplayShiftUpPt: number;
79
- readonly fractionDenominatorShiftDownPt: number;
80
- readonly fractionDenominatorDisplayShiftDownPt: number;
81
- readonly fractionNumeratorGapMinPt: number;
82
- readonly fractionDenominatorGapMinPt: number;
83
- readonly radicalRuleThicknessPt: number;
84
- readonly radicalExtraAscenderPt: number;
85
- readonly radicalVerticalGapPt: number;
86
- readonly radicalKernBeforeDegreePt: number;
87
- readonly radicalKernAfterDegreePt: number;
88
- readonly radicalDegreeBottomRaisePercent: number;
89
- readonly subscriptShiftDownPt: number;
90
- readonly superscriptShiftUpPt: number;
91
- readonly superscriptShiftUpCrampedPt: number;
92
- readonly subSuperscriptGapMinPt: number;
93
- readonly superscriptBaselineDropMaxPt: number;
94
- readonly subscriptBaselineDropMinPt: number;
95
- readonly spaceAfterScriptPt: number;
96
- readonly upperLimitGapMinPt: number;
97
- readonly upperLimitBaselineRiseMinPt: number;
98
- readonly lowerLimitGapMinPt: number;
99
- readonly lowerLimitBaselineDropMinPt: number;
100
- readonly stackTopShiftUpPt: number;
101
- readonly stackBottomShiftDownPt: number;
102
- readonly stackGapMinPt: number;
103
- readonly scriptPercentScaleDown: number;
104
- readonly scriptScriptPercentScaleDown: number;
105
- readonly defaultRuleThicknessPt: number;
106
- glyph(codePoint: number, sizePt: number): MathGlyphMetrics | undefined;
107
- stretch(codePoint: number, axis: MathStretchAxis, targetSizePt: number, sizePt: number): MathStretchResult | undefined;
108
- }
109
- //#endregion
110
- export { MathGlyphMetrics as a, MathLayoutItem as c, MathStretchResult as d, MathStroke as f, MathFontMetrics as i, MathRule as l, MathBox as n, MathGlyphPlacement as o, MathColor as r, MathGlyphRun as s, MathAssembledGlyphs as t, MathStretchGlyph as u };
@@ -1,110 +0,0 @@
1
- import { t as MathStretchAxis } from "./math-stretch-Bwk_bxh1.js";
2
- //#region src/math-types.d.ts
3
- interface MathColor {
4
- readonly r: number;
5
- readonly g: number;
6
- readonly b: number;
7
- }
8
- interface MathGlyphRun {
9
- readonly kind: 'glyphs';
10
- readonly xPt: number;
11
- readonly yPt: number;
12
- readonly text: string;
13
- readonly sizePt: number;
14
- readonly color: MathColor;
15
- }
16
- interface MathRule {
17
- readonly kind: 'rule';
18
- readonly xPt: number;
19
- readonly yPt: number;
20
- readonly widthPt: number;
21
- readonly heightPt: number;
22
- readonly color: MathColor;
23
- }
24
- interface MathStroke {
25
- readonly kind: 'stroke';
26
- readonly points: readonly {
27
- readonly xPt: number;
28
- readonly yPt: number;
29
- }[];
30
- readonly widthPt: number;
31
- readonly color: MathColor;
32
- }
33
- interface MathGlyphPlacement {
34
- readonly glyphId: number;
35
- readonly xPt: number;
36
- readonly yPt: number;
37
- }
38
- interface MathAssembledGlyphs {
39
- readonly kind: 'assembled-glyphs';
40
- readonly placements: readonly MathGlyphPlacement[];
41
- readonly text: string;
42
- readonly sizePt: number;
43
- readonly color: MathColor;
44
- }
45
- type MathLayoutItem = MathGlyphRun | MathRule | MathStroke | MathAssembledGlyphs;
46
- interface MathBox {
47
- readonly widthPt: number;
48
- readonly heightPt: number;
49
- readonly ascentPt: number;
50
- readonly descentPt: number;
51
- readonly items: readonly MathLayoutItem[];
52
- }
53
- interface MathGlyphMetrics {
54
- readonly advanceWidthPt: number;
55
- readonly italicCorrectionPt: number;
56
- readonly topAccentXPt?: number;
57
- readonly inkAscentPt?: number;
58
- readonly inkDescentPt?: number;
59
- }
60
- interface MathStretchGlyph {
61
- readonly glyphId: number;
62
- readonly offsetPt: number;
63
- }
64
- interface MathStretchResult {
65
- readonly kind: 'base' | 'variant' | 'assembly';
66
- readonly sizePt: number;
67
- readonly advanceWidthPt: number;
68
- readonly inkAscentPt: number;
69
- readonly inkDescentPt: number;
70
- readonly placements: readonly MathStretchGlyph[];
71
- }
72
- interface MathFontMetrics {
73
- readonly ascentPerEm: number;
74
- readonly descentPerEm: number;
75
- readonly axisHeightPt: number;
76
- readonly fractionRuleThicknessPt: number;
77
- readonly fractionNumeratorShiftUpPt: number;
78
- readonly fractionNumeratorDisplayShiftUpPt: number;
79
- readonly fractionDenominatorShiftDownPt: number;
80
- readonly fractionDenominatorDisplayShiftDownPt: number;
81
- readonly fractionNumeratorGapMinPt: number;
82
- readonly fractionDenominatorGapMinPt: number;
83
- readonly radicalRuleThicknessPt: number;
84
- readonly radicalExtraAscenderPt: number;
85
- readonly radicalVerticalGapPt: number;
86
- readonly radicalKernBeforeDegreePt: number;
87
- readonly radicalKernAfterDegreePt: number;
88
- readonly radicalDegreeBottomRaisePercent: number;
89
- readonly subscriptShiftDownPt: number;
90
- readonly superscriptShiftUpPt: number;
91
- readonly superscriptShiftUpCrampedPt: number;
92
- readonly subSuperscriptGapMinPt: number;
93
- readonly superscriptBaselineDropMaxPt: number;
94
- readonly subscriptBaselineDropMinPt: number;
95
- readonly spaceAfterScriptPt: number;
96
- readonly upperLimitGapMinPt: number;
97
- readonly upperLimitBaselineRiseMinPt: number;
98
- readonly lowerLimitGapMinPt: number;
99
- readonly lowerLimitBaselineDropMinPt: number;
100
- readonly stackTopShiftUpPt: number;
101
- readonly stackBottomShiftDownPt: number;
102
- readonly stackGapMinPt: number;
103
- readonly scriptPercentScaleDown: number;
104
- readonly scriptScriptPercentScaleDown: number;
105
- readonly defaultRuleThicknessPt: number;
106
- glyph(codePoint: number, sizePt: number): MathGlyphMetrics | undefined;
107
- stretch(codePoint: number, axis: MathStretchAxis, targetSizePt: number, sizePt: number): MathStretchResult | undefined;
108
- }
109
- //#endregion
110
- export { MathGlyphMetrics as a, MathLayoutItem as c, MathStretchResult as d, MathStroke as f, MathFontMetrics as i, MathRule as l, MathBox as n, MathGlyphPlacement as o, MathColor as r, MathGlyphRun as s, MathAssembledGlyphs as t, MathStretchGlyph as u };
File without changes
@@ -1,3 +0,0 @@
1
- import { t as MathStretchAxis } from "./math-stretch-DXWjs8gL.cjs";
2
- import { a as MathGlyphMetrics, c as MathLayoutItem, d as MathStretchResult, f as MathStroke, i as MathFontMetrics, l as MathRule, n as MathBox, o as MathGlyphPlacement, r as MathColor, s as MathGlyphRun, t as MathAssembledGlyphs, u as MathStretchGlyph } from "./math-types-BZkWO5Ow.cjs";
3
- export { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, type MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke };
@@ -1,3 +0,0 @@
1
- import { t as MathStretchAxis } from "./math-stretch-Bwk_bxh1.js";
2
- import { a as MathGlyphMetrics, c as MathLayoutItem, d as MathStretchResult, f as MathStroke, i as MathFontMetrics, l as MathRule, n as MathBox, o as MathGlyphPlacement, r as MathColor, s as MathGlyphRun, t as MathAssembledGlyphs, u as MathStretchGlyph } from "./math-types-Bq7tyV4g.js";
3
- export { MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, type MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke };
File without changes