pdf-codec 1.10.10 → 1.11.1
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/font-face.cjs +50 -0
- package/dist/font-face.d.cts +12 -0
- package/dist/font-face.d.ts +12 -0
- package/dist/font-face.js +48 -0
- package/dist/font-tables.cjs +2 -1
- package/dist/font-tables.d.cts +1 -0
- package/dist/font-tables.d.ts +1 -0
- package/dist/font-tables.js +2 -1
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sfnt = require("./sfnt.cjs");
|
|
3
|
+
const require_font_tables = require("./font-tables.cjs");
|
|
4
|
+
//#region src/font-face.ts
|
|
5
|
+
var FontFaceParseError = class extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "FontFaceParseError";
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const SFNT_VERSION_COLLECTION = 1953784678;
|
|
12
|
+
function isTrueTypeCollection(bytes) {
|
|
13
|
+
return require_sfnt.hasBytes(bytes, 0, 4) && require_sfnt.u32(bytes, 0) === SFNT_VERSION_COLLECTION;
|
|
14
|
+
}
|
|
15
|
+
const OS2_FS_SELECTION_ITALIC = 1;
|
|
16
|
+
const OS2_FS_SELECTION_BOLD = 32;
|
|
17
|
+
const HEAD_MAC_STYLE_BOLD = 1;
|
|
18
|
+
const HEAD_MAC_STYLE_ITALIC = 2;
|
|
19
|
+
function readStyle(head, os2, source) {
|
|
20
|
+
if (os2 !== void 0) return {
|
|
21
|
+
bold: (os2.fsSelection & OS2_FS_SELECTION_BOLD) !== 0,
|
|
22
|
+
italic: (os2.fsSelection & OS2_FS_SELECTION_ITALIC) !== 0
|
|
23
|
+
};
|
|
24
|
+
if (head !== void 0) return {
|
|
25
|
+
bold: (head.macStyle & HEAD_MAC_STYLE_BOLD) !== 0,
|
|
26
|
+
italic: (head.macStyle & HEAD_MAC_STYLE_ITALIC) !== 0
|
|
27
|
+
};
|
|
28
|
+
throw new FontFaceParseError(`${source} declares neither a readable 'OS/2' nor a readable 'head' table, so its weight and slope cannot be determined`);
|
|
29
|
+
}
|
|
30
|
+
function readFamily(name, source) {
|
|
31
|
+
if (name?.familyName === void 0) throw new FontFaceParseError(`${source} declares no family name in its 'name' table, so the font family it provides cannot be determined`);
|
|
32
|
+
return name.familyName;
|
|
33
|
+
}
|
|
34
|
+
function readFontFace(bytes, source) {
|
|
35
|
+
const font = require_sfnt.parseSfnt(bytes);
|
|
36
|
+
if (font === void 0) {
|
|
37
|
+
if (isTrueTypeCollection(bytes)) throw new FontFaceParseError(`${source} is a TrueType Collection (.ttc), which packs several faces into one file; extract the single face you want and pass that instead`);
|
|
38
|
+
throw new FontFaceParseError(`${source} is not a TrueType/OpenType font file (no recognised sfnt version); a .woff/.woff2 file must be converted to .ttf/.otf first`);
|
|
39
|
+
}
|
|
40
|
+
const family = readFamily(require_font_tables.parseName(font), source);
|
|
41
|
+
const { bold, italic } = readStyle(require_font_tables.parseHead(font), require_font_tables.parseOs2(font), source);
|
|
42
|
+
return {
|
|
43
|
+
family,
|
|
44
|
+
bold,
|
|
45
|
+
italic
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.FontFaceParseError = FontFaceParseError;
|
|
50
|
+
exports.readFontFace = readFontFace;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/font-face.d.ts
|
|
2
|
+
interface FontFace {
|
|
3
|
+
readonly family: string;
|
|
4
|
+
readonly bold: boolean;
|
|
5
|
+
readonly italic: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare class FontFaceParseError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
declare function readFontFace(bytes: Uint8Array<ArrayBuffer>, source: string): FontFace;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FontFace, FontFaceParseError, readFontFace };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/font-face.d.ts
|
|
2
|
+
interface FontFace {
|
|
3
|
+
readonly family: string;
|
|
4
|
+
readonly bold: boolean;
|
|
5
|
+
readonly italic: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare class FontFaceParseError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
declare function readFontFace(bytes: Uint8Array<ArrayBuffer>, source: string): FontFace;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FontFace, FontFaceParseError, readFontFace };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { hasBytes, parseSfnt, u32 } from "./sfnt.js";
|
|
2
|
+
import { parseHead, parseName, parseOs2 } from "./font-tables.js";
|
|
3
|
+
//#region src/font-face.ts
|
|
4
|
+
var FontFaceParseError = class extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "FontFaceParseError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const SFNT_VERSION_COLLECTION = 1953784678;
|
|
11
|
+
function isTrueTypeCollection(bytes) {
|
|
12
|
+
return hasBytes(bytes, 0, 4) && u32(bytes, 0) === SFNT_VERSION_COLLECTION;
|
|
13
|
+
}
|
|
14
|
+
const OS2_FS_SELECTION_ITALIC = 1;
|
|
15
|
+
const OS2_FS_SELECTION_BOLD = 32;
|
|
16
|
+
const HEAD_MAC_STYLE_BOLD = 1;
|
|
17
|
+
const HEAD_MAC_STYLE_ITALIC = 2;
|
|
18
|
+
function readStyle(head, os2, source) {
|
|
19
|
+
if (os2 !== void 0) return {
|
|
20
|
+
bold: (os2.fsSelection & OS2_FS_SELECTION_BOLD) !== 0,
|
|
21
|
+
italic: (os2.fsSelection & OS2_FS_SELECTION_ITALIC) !== 0
|
|
22
|
+
};
|
|
23
|
+
if (head !== void 0) return {
|
|
24
|
+
bold: (head.macStyle & HEAD_MAC_STYLE_BOLD) !== 0,
|
|
25
|
+
italic: (head.macStyle & HEAD_MAC_STYLE_ITALIC) !== 0
|
|
26
|
+
};
|
|
27
|
+
throw new FontFaceParseError(`${source} declares neither a readable 'OS/2' nor a readable 'head' table, so its weight and slope cannot be determined`);
|
|
28
|
+
}
|
|
29
|
+
function readFamily(name, source) {
|
|
30
|
+
if (name?.familyName === void 0) throw new FontFaceParseError(`${source} declares no family name in its 'name' table, so the font family it provides cannot be determined`);
|
|
31
|
+
return name.familyName;
|
|
32
|
+
}
|
|
33
|
+
function readFontFace(bytes, source) {
|
|
34
|
+
const font = parseSfnt(bytes);
|
|
35
|
+
if (font === void 0) {
|
|
36
|
+
if (isTrueTypeCollection(bytes)) throw new FontFaceParseError(`${source} is a TrueType Collection (.ttc), which packs several faces into one file; extract the single face you want and pass that instead`);
|
|
37
|
+
throw new FontFaceParseError(`${source} is not a TrueType/OpenType font file (no recognised sfnt version); a .woff/.woff2 file must be converted to .ttf/.otf first`);
|
|
38
|
+
}
|
|
39
|
+
const family = readFamily(parseName(font), source);
|
|
40
|
+
const { bold, italic } = readStyle(parseHead(font), parseOs2(font), source);
|
|
41
|
+
return {
|
|
42
|
+
family,
|
|
43
|
+
bold,
|
|
44
|
+
italic
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { FontFaceParseError, readFontFace };
|
package/dist/font-tables.cjs
CHANGED
|
@@ -20,7 +20,8 @@ function parseHead(font) {
|
|
|
20
20
|
yMin: require_sfnt.i16(bytes, 38),
|
|
21
21
|
xMax: require_sfnt.i16(bytes, 40),
|
|
22
22
|
yMax: require_sfnt.i16(bytes, 42),
|
|
23
|
-
indexToLocFormat
|
|
23
|
+
indexToLocFormat,
|
|
24
|
+
macStyle: require_sfnt.u16(bytes, 44)
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
const MAXP_HEADER_SIZE = 6;
|
package/dist/font-tables.d.cts
CHANGED
package/dist/font-tables.d.ts
CHANGED
package/dist/font-tables.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -24,10 +24,12 @@ const require_measure = require("./measure.cjs");
|
|
|
24
24
|
const require_write = require("./write.cjs");
|
|
25
25
|
const require_read = require("./read.cjs");
|
|
26
26
|
const require_codec = require("./codec.cjs");
|
|
27
|
+
const require_font_face = require("./font-face.cjs");
|
|
27
28
|
const require_text_layout = require("./text-layout.cjs");
|
|
28
29
|
exports.ByteReader = require_bytes_reader.ByteReader;
|
|
29
30
|
exports.ByteWriter = require_bytes_writer.ByteWriter;
|
|
30
31
|
exports.DEFAULT_VERTICAL_METRIC_POLICY = require_measure.DEFAULT_VERTICAL_METRIC_POLICY;
|
|
32
|
+
exports.FontFaceParseError = require_font_face.FontFaceParseError;
|
|
31
33
|
exports.Jbig2ParseError = require_image_jbig2_errors.Jbig2ParseError;
|
|
32
34
|
exports.Jbig2UnsupportedError = require_image_jbig2_errors.Jbig2UnsupportedError;
|
|
33
35
|
exports.Jpeg2000ParseError = require_image_jpeg2000_errors.Jpeg2000ParseError;
|
|
@@ -59,6 +61,7 @@ exports.loadMathFont = require_math_font.loadMathFont;
|
|
|
59
61
|
exports.looksLikeBareCodestream = require_image_jp2_boxes.looksLikeBareCodestream;
|
|
60
62
|
exports.parseJp2Container = require_image_jp2_boxes.parseJp2Container;
|
|
61
63
|
exports.pdfCodec = require_codec.pdfCodec;
|
|
64
|
+
exports.readFontFace = require_font_face.readFontFace;
|
|
62
65
|
exports.readJpeg2000Metadata = require_image_jpeg2000.readJpeg2000Metadata;
|
|
63
66
|
exports.readJpegInfo = require_image_jpeg_info.readJpegInfo;
|
|
64
67
|
exports.readPdf = require_read.readPdf;
|
package/dist/index.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedF
|
|
|
10
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";
|
|
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
|
+
import { FontFace, FontFaceParseError, readFontFace } from "./font-face.cjs";
|
|
13
14
|
import { i as Point, u as rotatePointAboutCenter } from "./matrix-BHzJESll.cjs";
|
|
14
15
|
import { ResolvedFont, resolveStandardFont } from "./fonts.cjs";
|
|
15
16
|
import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-gFNB8DmQ.cjs";
|
|
@@ -31,4 +32,4 @@ import { ReadPdfOptions, readPdf } from "./read.cjs";
|
|
|
31
32
|
import { WritePdfOptions, writePdf } from "./write.cjs";
|
|
32
33
|
import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.cjs";
|
|
33
34
|
import { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth } from "./text-layout.cjs";
|
|
34
|
-
export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, 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, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, scaleMathStretchConstruction, unfilterScanlines, wrapRunsToWidth, writePdf };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedF
|
|
|
10
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";
|
|
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
|
+
import { FontFace, FontFaceParseError, readFontFace } from "./font-face.js";
|
|
13
14
|
import { i as Point, u as rotatePointAboutCenter } from "./matrix-BHzJESll.js";
|
|
14
15
|
import { ResolvedFont, resolveStandardFont } from "./fonts.js";
|
|
15
16
|
import { a as MathGlyphPart, c as MathVariants, n as MathGlyphAssembly, o as MathGlyphVariant, r as MathGlyphConstruction } from "./math-table-DhPrNoPa.js";
|
|
@@ -31,4 +32,4 @@ import { ReadPdfOptions, readPdf } from "./read.js";
|
|
|
31
32
|
import { WritePdfOptions, writePdf } from "./write.js";
|
|
32
33
|
import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.js";
|
|
33
34
|
import { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth } from "./text-layout.js";
|
|
34
|
-
export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, 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, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, scaleMathStretchConstruction, unfilterScanlines, wrapRunsToWidth, writePdf };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -23,5 +23,6 @@ import { DEFAULT_VERTICAL_METRIC_POLICY, createFontMeasurer, createStandardFontM
|
|
|
23
23
|
import { writePdf } from "./write.js";
|
|
24
24
|
import { readPdf } from "./read.js";
|
|
25
25
|
import { PdfBytesSchema, pdfCodec } from "./codec.js";
|
|
26
|
+
import { FontFaceParseError, readFontFace } from "./font-face.js";
|
|
26
27
|
import { wrapRunsToWidth } from "./text-layout.js";
|
|
27
|
-
export { ByteReader, ByteWriter, DEFAULT_VERTICAL_METRIC_POLICY, 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, readJpeg2000Metadata, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, scaleMathStretchConstruction, unfilterScanlines, wrapRunsToWidth, writePdf };
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-codec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
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": {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"license": "MIT",
|
|
71
71
|
"packageManager": "pnpm@11.6.0",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"document-schema.js": "^2.
|
|
73
|
+
"document-schema.js": "^2.3.0",
|
|
74
74
|
"fflate": "^0.8.3",
|
|
75
75
|
"zod": "^4.4.3"
|
|
76
76
|
},
|