postext-pdf 1.63.1 → 1.63.3
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/__bench__/arabicShaping.bench.test.js +1 -1
- package/dist/__bench__/arabicShaping.bench.test.js.map +1 -1
- package/dist/__tests__/accessibility.test.js +1 -1
- package/dist/__tests__/accessibility.test.js.map +1 -1
- package/dist/__tests__/boxBorderInside.test.js +1 -1
- package/dist/__tests__/boxBorderInside.test.js.map +1 -1
- package/dist/__tests__/boxShape.test.js +2 -2
- package/dist/__tests__/boxShape.test.js.map +1 -1
- package/dist/__tests__/canvasShaping.test.d.ts +1 -1
- package/dist/__tests__/canvasShaping.test.d.ts.map +1 -1
- package/dist/__tests__/canvasShaping.test.js +1 -1
- package/dist/__tests__/canvasShaping.test.js.map +1 -1
- package/dist/__tests__/comic.test.js +1 -1
- package/dist/__tests__/comic.test.js.map +1 -1
- package/dist/__tests__/comicMarkPairs.test.js +1 -1
- package/dist/__tests__/comicMarkPairs.test.js.map +1 -1
- package/dist/__tests__/composedDecorationImages.test.js +1 -1
- package/dist/__tests__/composedDecorationImages.test.js.map +1 -1
- package/dist/__tests__/composedFrameBoxes.test.js +1 -1
- package/dist/__tests__/composedFrameBoxes.test.js.map +1 -1
- package/dist/__tests__/composedPage.test.js +2 -2
- package/dist/__tests__/composedPage.test.js.map +1 -1
- package/dist/__tests__/declaredFiles.test.js +1 -1
- package/dist/__tests__/declaredFiles.test.js.map +1 -1
- package/dist/__tests__/dottedText.test.js +3 -3
- package/dist/__tests__/dottedText.test.js.map +1 -1
- package/dist/__tests__/headerFooter.test.js +2 -2
- package/dist/__tests__/headerFooter.test.js.map +1 -1
- package/dist/__tests__/pathBlock.test.js +2 -2
- package/dist/__tests__/pathBlock.test.js.map +1 -1
- package/dist/__tests__/printMaster.test.js +1 -1
- package/dist/__tests__/printMaster.test.js.map +1 -1
- package/dist/__tests__/rtlPdf.test.js +1 -1
- package/dist/__tests__/rtlPdf.test.js.map +1 -1
- package/dist/__tests__/shapingLanguage.test.js +1 -1
- package/dist/__tests__/shapingLanguage.test.js.map +1 -1
- package/dist/__tests__/shapingLanguageRuns.test.js +1 -1
- package/dist/__tests__/shapingLanguageRuns.test.js.map +1 -1
- package/dist/__tests__/shapingLanguageRunsDocument.test.js +1 -1
- package/dist/__tests__/shapingLanguageRunsDocument.test.js.map +1 -1
- package/dist/__tests__/sharedGlyphReadback.test.d.ts +1 -1
- package/dist/__tests__/sharedGlyphReadback.test.d.ts.map +1 -1
- package/dist/__tests__/sharedGlyphReadback.test.js +1 -1
- package/dist/__tests__/sharedGlyphReadback.test.js.map +1 -1
- package/dist/__tests__/svgVector.test.js +2 -2
- package/dist/__tests__/svgVector.test.js.map +1 -1
- package/dist/faceFiles.js +1 -1
- package/dist/faceFiles.js.map +1 -1
- package/dist/fontCache/fontFiles.d.ts +172 -0
- package/dist/fontCache/fontFiles.d.ts.map +1 -0
- package/dist/fontCache/fontFiles.js +81 -0
- package/dist/fontCache/fontFiles.js.map +1 -0
- package/dist/fontCache/glyphTables.d.ts +38 -0
- package/dist/fontCache/glyphTables.d.ts.map +1 -0
- package/dist/fontCache/glyphTables.js +107 -0
- package/dist/fontCache/glyphTables.js.map +1 -0
- package/dist/fontCache.d.ts +5 -189
- package/dist/fontCache.d.ts.map +1 -1
- package/dist/fontCache.js +5 -184
- package/dist/fontCache.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/pdf-backend/blocks/blockRender/lineText.d.ts +23 -0
- package/dist/pdf-backend/blocks/blockRender/lineText.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/blockRender/lineText.js +200 -0
- package/dist/pdf-backend/blocks/blockRender/lineText.js.map +1 -0
- package/dist/pdf-backend/blocks/blockRender/markers.d.ts +23 -0
- package/dist/pdf-backend/blocks/blockRender/markers.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/blockRender/markers.js +140 -0
- package/dist/pdf-backend/blocks/blockRender/markers.js.map +1 -0
- package/dist/pdf-backend/blocks/blockRender/segments.d.ts +74 -0
- package/dist/pdf-backend/blocks/blockRender/segments.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/blockRender/segments.js +409 -0
- package/dist/pdf-backend/blocks/blockRender/segments.js.map +1 -0
- package/dist/pdf-backend/{blockRender.d.ts → blocks/blockRender.d.ts} +7 -10
- package/dist/pdf-backend/blocks/blockRender.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/blockRender.js +146 -0
- package/dist/pdf-backend/blocks/blockRender.js.map +1 -0
- package/dist/pdf-backend/{chip.d.ts → blocks/chip.d.ts} +3 -3
- package/dist/pdf-backend/blocks/chip.d.ts.map +1 -0
- package/dist/pdf-backend/{chip.js → blocks/chip.js} +5 -5
- package/dist/pdf-backend/blocks/chip.js.map +1 -0
- package/dist/pdf-backend/{inlineIcon.d.ts → blocks/inlineIcon.d.ts} +3 -3
- package/dist/pdf-backend/blocks/inlineIcon.d.ts.map +1 -0
- package/dist/pdf-backend/{inlineIcon.js → blocks/inlineIcon.js} +3 -3
- package/dist/pdf-backend/blocks/inlineIcon.js.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/lines.d.ts +37 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/lines.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/lines.js +271 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/lines.js.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/overlays.d.ts +21 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/overlays.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/overlays.js +164 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/overlays.js.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/preload.d.ts +27 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/preload.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/preload.js +330 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/preload.js.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/rasterize.d.ts +38 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/rasterize.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/rasterize.js +218 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/rasterize.js.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/table.d.ts +17 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/table.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/table.js +203 -0
- package/dist/pdf-backend/blocks/renderResourceBlock/table.js.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock.d.ts +59 -0
- package/dist/pdf-backend/blocks/renderResourceBlock.d.ts.map +1 -0
- package/dist/pdf-backend/blocks/renderResourceBlock.js +201 -0
- package/dist/pdf-backend/blocks/renderResourceBlock.js.map +1 -0
- package/dist/pdf-backend/{scoreRender.d.ts → blocks/scoreRender.d.ts} +2 -2
- package/dist/pdf-backend/blocks/scoreRender.d.ts.map +1 -0
- package/dist/pdf-backend/{scoreRender.js → blocks/scoreRender.js} +2 -2
- package/dist/pdf-backend/blocks/scoreRender.js.map +1 -0
- package/dist/pdf-backend/{taskBox.d.ts → blocks/taskBox.d.ts} +1 -1
- package/dist/pdf-backend/blocks/taskBox.d.ts.map +1 -0
- package/dist/pdf-backend/{taskBox.js → blocks/taskBox.js} +1 -1
- package/dist/pdf-backend/blocks/taskBox.js.map +1 -0
- package/dist/pdf-backend/index.d.ts +8 -114
- package/dist/pdf-backend/index.d.ts.map +1 -1
- package/dist/pdf-backend/index.js +16 -614
- package/dist/pdf-backend/index.js.map +1 -1
- package/dist/pdf-backend/{comic.d.ts → page/comic.d.ts} +6 -6
- package/dist/pdf-backend/page/comic.d.ts.map +1 -0
- package/dist/pdf-backend/{comic.js → page/comic.js} +4 -4
- package/dist/pdf-backend/page/comic.js.map +1 -0
- package/dist/pdf-backend/{headerFooter.d.ts → page/headerFooter.d.ts} +4 -4
- package/dist/pdf-backend/page/headerFooter.d.ts.map +1 -0
- package/dist/pdf-backend/{headerFooter.js → page/headerFooter.js} +8 -8
- package/dist/pdf-backend/page/headerFooter.js.map +1 -0
- package/dist/pdf-backend/{pageDecorations.d.ts → page/pageDecorations.d.ts} +1 -1
- package/dist/pdf-backend/page/pageDecorations.d.ts.map +1 -0
- package/dist/pdf-backend/{pageDecorations.js → page/pageDecorations.js} +1 -1
- package/dist/pdf-backend/page/pageDecorations.js.map +1 -0
- package/dist/pdf-backend/page/pageLabels.d.ts.map +1 -0
- package/dist/pdf-backend/page/pageLabels.js.map +1 -0
- package/dist/pdf-backend/primitives/actualText.d.ts +91 -0
- package/dist/pdf-backend/primitives/actualText.d.ts.map +1 -0
- package/dist/pdf-backend/primitives/actualText.js +154 -0
- package/dist/pdf-backend/primitives/actualText.js.map +1 -0
- package/dist/pdf-backend/primitives/color.d.ts +22 -0
- package/dist/pdf-backend/primitives/color.d.ts.map +1 -0
- package/dist/pdf-backend/primitives/color.js +116 -0
- package/dist/pdf-backend/primitives/color.js.map +1 -0
- package/dist/pdf-backend/primitives/matrix.d.ts +55 -0
- package/dist/pdf-backend/primitives/matrix.d.ts.map +1 -0
- package/dist/pdf-backend/primitives/matrix.js +124 -0
- package/dist/pdf-backend/primitives/matrix.js.map +1 -0
- package/dist/pdf-backend/primitives/measuredText.d.ts +61 -0
- package/dist/pdf-backend/primitives/measuredText.d.ts.map +1 -0
- package/dist/pdf-backend/primitives/measuredText.js +142 -0
- package/dist/pdf-backend/primitives/measuredText.js.map +1 -0
- package/dist/pdf-backend/primitives/shapedRuns.d.ts +49 -0
- package/dist/pdf-backend/primitives/shapedRuns.d.ts.map +1 -0
- package/dist/pdf-backend/primitives/shapedRuns.js +367 -0
- package/dist/pdf-backend/primitives/shapedRuns.js.map +1 -0
- package/dist/pdf-backend/primitives/shapes.d.ts +35 -0
- package/dist/pdf-backend/primitives/shapes.d.ts.map +1 -0
- package/dist/pdf-backend/primitives/shapes.js +166 -0
- package/dist/pdf-backend/primitives/shapes.js.map +1 -0
- package/dist/pdf-backend/primitives/textShows.d.ts +90 -0
- package/dist/pdf-backend/primitives/textShows.d.ts.map +1 -0
- package/dist/pdf-backend/primitives/textShows.js +167 -0
- package/dist/pdf-backend/primitives/textShows.js.map +1 -0
- package/dist/pdf-backend/primitives.d.ts +16 -308
- package/dist/pdf-backend/primitives.d.ts.map +1 -1
- package/dist/pdf-backend/primitives.js +15 -1195
- package/dist/pdf-backend/primitives.js.map +1 -1
- package/dist/pdf-backend/renderToPdf/composedFrames.d.ts +19 -0
- package/dist/pdf-backend/renderToPdf/composedFrames.d.ts.map +1 -0
- package/dist/pdf-backend/renderToPdf/composedFrames.js +156 -0
- package/dist/pdf-backend/renderToPdf/composedFrames.js.map +1 -0
- package/dist/pdf-backend/renderToPdf/metadata.d.ts +31 -0
- package/dist/pdf-backend/renderToPdf/metadata.d.ts.map +1 -0
- package/dist/pdf-backend/renderToPdf/metadata.js +85 -0
- package/dist/pdf-backend/renderToPdf/metadata.js.map +1 -0
- package/dist/pdf-backend/renderToPdf/paintPage.d.ts +16 -0
- package/dist/pdf-backend/renderToPdf/paintPage.d.ts.map +1 -0
- package/dist/pdf-backend/renderToPdf/paintPage.js +348 -0
- package/dist/pdf-backend/renderToPdf/paintPage.js.map +1 -0
- package/dist/pdf-backend/renderToPdf/warnings.d.ts +114 -0
- package/dist/pdf-backend/renderToPdf/warnings.d.ts.map +1 -0
- package/dist/pdf-backend/renderToPdf/warnings.js +35 -0
- package/dist/pdf-backend/renderToPdf/warnings.js.map +1 -0
- package/dist/pdf-backend/structure/links.d.ts.map +1 -0
- package/dist/pdf-backend/structure/links.js.map +1 -0
- package/dist/pdf-backend/structure/outlines.d.ts.map +1 -0
- package/dist/pdf-backend/structure/outlines.js.map +1 -0
- package/dist/pdf-backend/structure/structureFlow.d.ts.map +1 -0
- package/dist/pdf-backend/structure/structureFlow.js.map +1 -0
- package/dist/pdf-backend/{tagging.d.ts → structure/tagging.d.ts} +1 -1
- package/dist/pdf-backend/structure/tagging.d.ts.map +1 -0
- package/dist/pdf-backend/structure/tagging.js.map +1 -0
- package/dist/pdf-backend/{annotations.d.ts → text/annotations.d.ts} +3 -3
- package/dist/pdf-backend/text/annotations.d.ts.map +1 -0
- package/dist/pdf-backend/{annotations.js → text/annotations.js} +3 -3
- package/dist/pdf-backend/text/annotations.js.map +1 -0
- package/dist/pdf-backend/{directedLine.d.ts → text/directedLine.d.ts} +1 -1
- package/dist/pdf-backend/text/directedLine.d.ts.map +1 -0
- package/dist/pdf-backend/{directedLine.js → text/directedLine.js} +1 -1
- package/dist/pdf-backend/text/directedLine.js.map +1 -0
- package/dist/pdf-backend/text/fallbackSpaces.d.ts.map +1 -0
- package/dist/pdf-backend/text/fallbackSpaces.js.map +1 -0
- package/dist/pdf-backend/text/fontHelpers.d.ts.map +1 -0
- package/dist/pdf-backend/text/fontHelpers.js.map +1 -0
- package/dist/pdf-backend/text/inkScale.d.ts.map +1 -0
- package/dist/pdf-backend/text/inkScale.js.map +1 -0
- package/dist/pdf-backend/{rtlRun.d.ts → text/rtlRun.d.ts} +1 -1
- package/dist/pdf-backend/text/rtlRun.d.ts.map +1 -0
- package/dist/pdf-backend/{rtlRun.js → text/rtlRun.js} +2 -2
- package/dist/pdf-backend/text/rtlRun.js.map +1 -0
- package/dist/pdf-backend/text/shapedText/shaping.d.ts +70 -0
- package/dist/pdf-backend/text/shapedText/shaping.d.ts.map +1 -0
- package/dist/pdf-backend/text/shapedText/shaping.js +380 -0
- package/dist/pdf-backend/text/shapedText/shaping.js.map +1 -0
- package/dist/pdf-backend/{shapedText.d.ts → text/shapedText.d.ts} +2 -2
- package/dist/pdf-backend/text/shapedText.d.ts.map +1 -0
- package/dist/pdf-backend/text/shapedText.js +311 -0
- package/dist/pdf-backend/text/shapedText.js.map +1 -0
- package/dist/pdf-backend/{verticalText.d.ts → text/verticalText.d.ts} +1 -1
- package/dist/pdf-backend/text/verticalText.d.ts.map +1 -0
- package/dist/pdf-backend/{verticalText.js → text/verticalText.js} +4 -4
- package/dist/pdf-backend/text/verticalText.js.map +1 -0
- package/dist/pdf-backend/text/wordPieces.d.ts.map +1 -0
- package/dist/pdf-backend/{wordPieces.js → text/wordPieces.js} +1 -1
- package/dist/pdf-backend/text/wordPieces.js.map +1 -0
- package/dist/pdf-backend/{pathBlock.d.ts → vector/pathBlock.d.ts} +1 -1
- package/dist/pdf-backend/vector/pathBlock.d.ts.map +1 -0
- package/dist/pdf-backend/{pathBlock.js → vector/pathBlock.js} +1 -1
- package/dist/pdf-backend/vector/pathBlock.js.map +1 -0
- package/dist/pdf-backend/vector/svgVector/emit.d.ts +11 -0
- package/dist/pdf-backend/vector/svgVector/emit.d.ts.map +1 -0
- package/dist/pdf-backend/vector/svgVector/emit.js +281 -0
- package/dist/pdf-backend/vector/svgVector/emit.js.map +1 -0
- package/dist/pdf-backend/vector/svgVector/geometry.d.ts +18 -0
- package/dist/pdf-backend/vector/svgVector/geometry.d.ts.map +1 -0
- package/dist/pdf-backend/vector/svgVector/geometry.js +382 -0
- package/dist/pdf-backend/vector/svgVector/geometry.js.map +1 -0
- package/dist/pdf-backend/vector/svgVector/style.d.ts +37 -0
- package/dist/pdf-backend/vector/svgVector/style.d.ts.map +1 -0
- package/dist/pdf-backend/vector/svgVector/style.js +314 -0
- package/dist/pdf-backend/vector/svgVector/style.js.map +1 -0
- package/dist/pdf-backend/vector/svgVector/walk.d.ts +15 -0
- package/dist/pdf-backend/vector/svgVector/walk.d.ts.map +1 -0
- package/dist/pdf-backend/vector/svgVector/walk.js +405 -0
- package/dist/pdf-backend/vector/svgVector/walk.js.map +1 -0
- package/dist/pdf-backend/vector/svgVector/xml.d.ts +20 -0
- package/dist/pdf-backend/vector/svgVector/xml.d.ts.map +1 -0
- package/dist/pdf-backend/vector/svgVector/xml.js +160 -0
- package/dist/pdf-backend/vector/svgVector/xml.js.map +1 -0
- package/dist/pdf-backend/{svgVector.d.ts → vector/svgVector.d.ts} +2 -12
- package/dist/pdf-backend/vector/svgVector.d.ts.map +1 -0
- package/dist/pdf-backend/vector/svgVector.js +95 -0
- package/dist/pdf-backend/vector/svgVector.js.map +1 -0
- package/dist/pdf-backend/vector/tint.d.ts.map +1 -0
- package/dist/pdf-backend/{tint.js → vector/tint.js} +1 -1
- package/dist/pdf-backend/vector/tint.js.map +1 -0
- package/dist/worker/client.d.ts +1 -1
- package/dist/worker/client.d.ts.map +1 -1
- package/dist/worker/client.js +1 -1
- package/dist/worker/client.js.map +1 -1
- package/package.json +3 -3
- package/dist/pdf-backend/annotations.d.ts.map +0 -1
- package/dist/pdf-backend/annotations.js.map +0 -1
- package/dist/pdf-backend/blockRender.d.ts.map +0 -1
- package/dist/pdf-backend/blockRender.js +0 -866
- package/dist/pdf-backend/blockRender.js.map +0 -1
- package/dist/pdf-backend/chip.d.ts.map +0 -1
- package/dist/pdf-backend/chip.js.map +0 -1
- package/dist/pdf-backend/comic.d.ts.map +0 -1
- package/dist/pdf-backend/comic.js.map +0 -1
- package/dist/pdf-backend/directedLine.d.ts.map +0 -1
- package/dist/pdf-backend/directedLine.js.map +0 -1
- package/dist/pdf-backend/fallbackSpaces.d.ts.map +0 -1
- package/dist/pdf-backend/fallbackSpaces.js.map +0 -1
- package/dist/pdf-backend/fontHelpers.d.ts.map +0 -1
- package/dist/pdf-backend/fontHelpers.js.map +0 -1
- package/dist/pdf-backend/headerFooter.d.ts.map +0 -1
- package/dist/pdf-backend/headerFooter.js.map +0 -1
- package/dist/pdf-backend/inkScale.d.ts.map +0 -1
- package/dist/pdf-backend/inkScale.js.map +0 -1
- package/dist/pdf-backend/inlineIcon.d.ts.map +0 -1
- package/dist/pdf-backend/inlineIcon.js.map +0 -1
- package/dist/pdf-backend/links.d.ts.map +0 -1
- package/dist/pdf-backend/links.js.map +0 -1
- package/dist/pdf-backend/outlines.d.ts.map +0 -1
- package/dist/pdf-backend/outlines.js.map +0 -1
- package/dist/pdf-backend/pageDecorations.d.ts.map +0 -1
- package/dist/pdf-backend/pageDecorations.js.map +0 -1
- package/dist/pdf-backend/pageLabels.d.ts.map +0 -1
- package/dist/pdf-backend/pageLabels.js.map +0 -1
- package/dist/pdf-backend/pathBlock.d.ts.map +0 -1
- package/dist/pdf-backend/pathBlock.js.map +0 -1
- package/dist/pdf-backend/renderResourceBlock.d.ts +0 -120
- package/dist/pdf-backend/renderResourceBlock.d.ts.map +0 -1
- package/dist/pdf-backend/renderResourceBlock.js +0 -1351
- package/dist/pdf-backend/renderResourceBlock.js.map +0 -1
- package/dist/pdf-backend/rtlRun.d.ts.map +0 -1
- package/dist/pdf-backend/rtlRun.js.map +0 -1
- package/dist/pdf-backend/scoreRender.d.ts.map +0 -1
- package/dist/pdf-backend/scoreRender.js.map +0 -1
- package/dist/pdf-backend/shapedText.d.ts.map +0 -1
- package/dist/pdf-backend/shapedText.js +0 -682
- package/dist/pdf-backend/shapedText.js.map +0 -1
- package/dist/pdf-backend/structureFlow.d.ts.map +0 -1
- package/dist/pdf-backend/structureFlow.js.map +0 -1
- package/dist/pdf-backend/svgVector.d.ts.map +0 -1
- package/dist/pdf-backend/svgVector.js +0 -1610
- package/dist/pdf-backend/svgVector.js.map +0 -1
- package/dist/pdf-backend/tagging.d.ts.map +0 -1
- package/dist/pdf-backend/tagging.js.map +0 -1
- package/dist/pdf-backend/taskBox.d.ts.map +0 -1
- package/dist/pdf-backend/taskBox.js.map +0 -1
- package/dist/pdf-backend/tint.d.ts.map +0 -1
- package/dist/pdf-backend/tint.js.map +0 -1
- package/dist/pdf-backend/verticalText.d.ts.map +0 -1
- package/dist/pdf-backend/verticalText.js.map +0 -1
- package/dist/pdf-backend/wordPieces.d.ts.map +0 -1
- package/dist/pdf-backend/wordPieces.js.map +0 -1
- /package/dist/pdf-backend/{pageLabels.d.ts → page/pageLabels.d.ts} +0 -0
- /package/dist/pdf-backend/{pageLabels.js → page/pageLabels.js} +0 -0
- /package/dist/pdf-backend/{links.d.ts → structure/links.d.ts} +0 -0
- /package/dist/pdf-backend/{links.js → structure/links.js} +0 -0
- /package/dist/pdf-backend/{outlines.d.ts → structure/outlines.d.ts} +0 -0
- /package/dist/pdf-backend/{outlines.js → structure/outlines.js} +0 -0
- /package/dist/pdf-backend/{structureFlow.d.ts → structure/structureFlow.d.ts} +0 -0
- /package/dist/pdf-backend/{structureFlow.js → structure/structureFlow.js} +0 -0
- /package/dist/pdf-backend/{tagging.js → structure/tagging.js} +0 -0
- /package/dist/pdf-backend/{fallbackSpaces.d.ts → text/fallbackSpaces.d.ts} +0 -0
- /package/dist/pdf-backend/{fallbackSpaces.js → text/fallbackSpaces.js} +0 -0
- /package/dist/pdf-backend/{fontHelpers.d.ts → text/fontHelpers.d.ts} +0 -0
- /package/dist/pdf-backend/{fontHelpers.js → text/fontHelpers.js} +0 -0
- /package/dist/pdf-backend/{inkScale.d.ts → text/inkScale.d.ts} +0 -0
- /package/dist/pdf-backend/{inkScale.js → text/inkScale.js} +0 -0
- /package/dist/pdf-backend/{wordPieces.d.ts → text/wordPieces.d.ts} +0 -0
- /package/dist/pdf-backend/{tint.d.ts → vector/tint.d.ts} +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type PDFFont, PDFOperator } from 'pdf-lib';
|
|
2
|
+
import { type ShownRun } from './shapedRuns.js';
|
|
3
|
+
export declare const ENCODE_CACHE_SLOTS = 50000;
|
|
4
|
+
/** A glyph fontkit laid out: its id in the font file and the characters
|
|
5
|
+
* the font's `/ToUnicode` map gives it (see {@link glyphReads}). */
|
|
6
|
+
export interface LaidGlyph {
|
|
7
|
+
id: number;
|
|
8
|
+
advanceWidth: number;
|
|
9
|
+
codePoints: number[];
|
|
10
|
+
}
|
|
11
|
+
/** The fontkit side of a pdf-lib custom font — what kerning needs. */
|
|
12
|
+
export interface ShapingFace {
|
|
13
|
+
unitsPerEm: number;
|
|
14
|
+
layout(text: string, features?: unknown): {
|
|
15
|
+
glyphs: LaidGlyph[];
|
|
16
|
+
positions: Array<{
|
|
17
|
+
xAdvance: number;
|
|
18
|
+
xOffset: number;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** A glyph of a show-text array read as `text`, not as the characters the
|
|
23
|
+
* font's `/ToUnicode` map gives it (#755, {@link glyphReads}): shown in a
|
|
24
|
+
* `/Span` of its own whose `/ActualText` is `text`. `hex` is its code. */
|
|
25
|
+
interface ReadGlyph {
|
|
26
|
+
hex: string;
|
|
27
|
+
text: string;
|
|
28
|
+
}
|
|
29
|
+
/** A part of a show-text array: a run of glyph codes, a pen adjustment, or
|
|
30
|
+
* a glyph read through a span. */
|
|
31
|
+
export type ShowPart = string | number | ReadGlyph;
|
|
32
|
+
/** Round a TJ adjustment to 1/100 of a text-space unit. */
|
|
33
|
+
export declare function tjNumber(n: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* The show-text operator for `text`, carrying the shaper's glyph positions.
|
|
36
|
+
*
|
|
37
|
+
* pdf-lib's `encodeText` shapes through fontkit but keeps only the glyph
|
|
38
|
+
* ids, so a viewer advances each glyph by its raw width (the `W` array) and
|
|
39
|
+
* the GPOS kerning the canvas measured with is lost: in a tightly kerned
|
|
40
|
+
* face (Geist: `referencia` is 0.21 em narrower kerned) each word paints
|
|
41
|
+
* wider than the layout engine placed it and eats the following space.
|
|
42
|
+
* Emit a `TJ` array instead whose numbers restore every glyph's
|
|
43
|
+
* `xAdvance` / `xOffset`; a run without adjustments stays a plain `Tj`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function showTextShaped(font: PDFFont, text: string, letterTj?: number): PDFOperator;
|
|
46
|
+
/** A show-text operator and the font (a file of the face) it shows in. */
|
|
47
|
+
export interface TextShow {
|
|
48
|
+
font: PDFFont;
|
|
49
|
+
op: PDFOperator;
|
|
50
|
+
}
|
|
51
|
+
/** The show-text operators of `text` in `font`'s face: one
|
|
52
|
+
* ({@link showTextShaped}) for a face of one file, else one per run of
|
|
53
|
+
* characters set in the same file (see `faceFiles.ts`). A glyph the
|
|
54
|
+
* font's `/ToUnicode` map reads as other text is shown in a span of its
|
|
55
|
+
* own ({@link glyphReads}), unless `read` is false: the caller reads the
|
|
56
|
+
* text some other way (an `/ActualText` over all of it, a figure's
|
|
57
|
+
* alternate text).
|
|
58
|
+
*
|
|
59
|
+
* In a document shaped in its own language the text is shaped word by
|
|
60
|
+
* word, as the canvas shaped it (`wordRuns`, #770), and the words that
|
|
61
|
+
* follow each other in one file are one operator; with `whole` it is
|
|
62
|
+
* shaped as one string, as the text of a drawing is (a browser lays an
|
|
63
|
+
* SVG's text out as it does a page's, not as its canvas does). */
|
|
64
|
+
export declare function textShows(font: PDFFont, text: string, read?: boolean, whole?: boolean, letterTj?: number): TextShow[];
|
|
65
|
+
/**
|
|
66
|
+
* The character spacing a ligature is owed for the letters it joins, as a
|
|
67
|
+
* `TJ` number (thousandths of the font size), for a text of `sizePx`
|
|
68
|
+
* painted under a character spacing of `trackingPx` (#770); 0 when it is
|
|
69
|
+
* owed none.
|
|
70
|
+
*
|
|
71
|
+
* The layout counts the tracking once a letter, and `Tc` follows every
|
|
72
|
+
* glyph: a ligature, one glyph for two or three letters, advanced by one
|
|
73
|
+
* tracking, and the word ended a tracking short of the width measured for
|
|
74
|
+
* each letter joined (`shift` in Source Serif 4 at 19.58 px, 0.39 px a
|
|
75
|
+
* letter: 0.39 px short). In a document shaped in its own language the
|
|
76
|
+
* pen moves on after a ligature by the tracking of its other letters
|
|
77
|
+
* ({@link letterTrackedParts}), as the canvas and the HTML set it; one
|
|
78
|
+
* that keeps the host's language prints as it did.
|
|
79
|
+
*/
|
|
80
|
+
export declare function letterTrackingTj(trackingPx: number, sizePx: number): number;
|
|
81
|
+
/**
|
|
82
|
+
* The parts of `run` with, after each glyph that stands for several
|
|
83
|
+
* letters ({@link ShownRun.joined}), a pen movement of `letterTj` for
|
|
84
|
+
* each letter but the first: the tracking `Tc` gave the glyph once and
|
|
85
|
+
* the layout counted once a letter. The run's own parts when it holds no
|
|
86
|
+
* such glyph or is not tracked.
|
|
87
|
+
*/
|
|
88
|
+
export declare function letterTrackedParts(run: ShownRun, letterTj: number): ShowPart[];
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=textShows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textShows.d.ts","sourceRoot":"","sources":["../../../src/pdf-backend/primitives/textShows.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,WAAW,EAAY,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAmD,KAAK,QAAQ,EAAY,MAAM,iBAAiB,CAAC;AAQ3G,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC;qEACqE;AACrE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG;QACxC,MAAM,EAAE,SAAS,EAAE,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACzD,CAAC;CACH;AAED;;2EAE2E;AAC3E,UAAU,SAAS;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;mCACmC;AACnC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEnD,2DAA2D;AAC3D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,WAAW,CA2BrF;AAED,0EAA0E;AAC1E,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,WAAW,CAAC;CACjB;AAED;;;;;;;;;;;;mEAYmE;AACnE,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,UAAO,EAAE,KAAK,UAAQ,EAAE,QAAQ,SAAI,GAAG,QAAQ,EAAE,CAU3G;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CA+B9E"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Show-text operators shaped once per font and text, letter tracking
|
|
2
|
+
// as TJ numbers, and the shows of a word (#1276: split out of primitives.ts).
|
|
3
|
+
import { showText } from 'pdf-lib';
|
|
4
|
+
import { noteMissingGlyphs, fileRuns, wordRuns, inRun } from '../../faceFiles.js';
|
|
5
|
+
import { shapingKey, shapesAsCanvas } from '../../shapingLanguage.js';
|
|
6
|
+
import { shownRun, partsOperator, plainParts, partsShows, pushPart } from './shapedRuns.js';
|
|
7
|
+
// Text is drawn a word at a time (the layout engine positions every
|
|
8
|
+
// word), and pdf-lib's `drawText` shapes each call afresh through fontkit —
|
|
9
|
+
// the same words, over and over. The show-text operator of a (font, text)
|
|
10
|
+
// pair never changes, so it is shaped once and reused; the font's resource
|
|
11
|
+
// key on a page likewise.
|
|
12
|
+
const showByFont = new WeakMap();
|
|
13
|
+
export const ENCODE_CACHE_SLOTS = 50_000;
|
|
14
|
+
/** Round a TJ adjustment to 1/100 of a text-space unit. */
|
|
15
|
+
export function tjNumber(n) {
|
|
16
|
+
return Math.round(n * 100) / 100;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The show-text operator for `text`, carrying the shaper's glyph positions.
|
|
20
|
+
*
|
|
21
|
+
* pdf-lib's `encodeText` shapes through fontkit but keeps only the glyph
|
|
22
|
+
* ids, so a viewer advances each glyph by its raw width (the `W` array) and
|
|
23
|
+
* the GPOS kerning the canvas measured with is lost: in a tightly kerned
|
|
24
|
+
* face (Geist: `referencia` is 0.21 em narrower kerned) each word paints
|
|
25
|
+
* wider than the layout engine placed it and eats the following space.
|
|
26
|
+
* Emit a `TJ` array instead whose numbers restore every glyph's
|
|
27
|
+
* `xAdvance` / `xOffset`; a run without adjustments stays a plain `Tj`.
|
|
28
|
+
*/
|
|
29
|
+
export function showTextShaped(font, text, letterTj = 0) {
|
|
30
|
+
// A tracked text with a ligature is another show at each tracking
|
|
31
|
+
// ({@link letterTrackedParts}); it is not kept.
|
|
32
|
+
if (letterTj !== 0) {
|
|
33
|
+
const spaced = shownRun(font, text);
|
|
34
|
+
if (spaced && spaced.joined.length > 0)
|
|
35
|
+
return partsOperator(font, plainParts(letterTrackedParts(spaced, letterTj)));
|
|
36
|
+
}
|
|
37
|
+
let cache = showByFont.get(font);
|
|
38
|
+
if (!cache) {
|
|
39
|
+
cache = new Map();
|
|
40
|
+
showByFont.set(font, cache);
|
|
41
|
+
}
|
|
42
|
+
// Text shaped in another language or script is another show.
|
|
43
|
+
const key = shapingKey(text);
|
|
44
|
+
const hit = cache.get(key);
|
|
45
|
+
if (hit)
|
|
46
|
+
return hit;
|
|
47
|
+
const run = shownRun(font, text);
|
|
48
|
+
let op;
|
|
49
|
+
if (run)
|
|
50
|
+
op = partsOperator(font, plainParts(run.parts));
|
|
51
|
+
else {
|
|
52
|
+
// A standard font: no shaper, pdf-lib's own encoding.
|
|
53
|
+
noteMissingGlyphs(font, text);
|
|
54
|
+
op = showText(font.encodeText(text));
|
|
55
|
+
}
|
|
56
|
+
if (cache.size >= ENCODE_CACHE_SLOTS)
|
|
57
|
+
cache.clear();
|
|
58
|
+
cache.set(key, op);
|
|
59
|
+
return op;
|
|
60
|
+
}
|
|
61
|
+
/** The show-text operators of `text` in `font`'s face: one
|
|
62
|
+
* ({@link showTextShaped}) for a face of one file, else one per run of
|
|
63
|
+
* characters set in the same file (see `faceFiles.ts`). A glyph the
|
|
64
|
+
* font's `/ToUnicode` map reads as other text is shown in a span of its
|
|
65
|
+
* own ({@link glyphReads}), unless `read` is false: the caller reads the
|
|
66
|
+
* text some other way (an `/ActualText` over all of it, a figure's
|
|
67
|
+
* alternate text).
|
|
68
|
+
*
|
|
69
|
+
* In a document shaped in its own language the text is shaped word by
|
|
70
|
+
* word, as the canvas shaped it (`wordRuns`, #770), and the words that
|
|
71
|
+
* follow each other in one file are one operator; with `whole` it is
|
|
72
|
+
* shaped as one string, as the text of a drawing is (a browser lays an
|
|
73
|
+
* SVG's text out as it does a page's, not as its canvas does). */
|
|
74
|
+
export function textShows(font, text, read = true, whole = false, letterTj = 0) {
|
|
75
|
+
const runs = whole ? fileRuns(font, text) : wordRuns(font, text);
|
|
76
|
+
if (runs.length > 1 && !whole && shapesAsCanvas()) {
|
|
77
|
+
const joined = joinedShows(runs, read, letterTj);
|
|
78
|
+
if (joined)
|
|
79
|
+
return joined;
|
|
80
|
+
}
|
|
81
|
+
return runs.flatMap((run) => inRun(run, () => {
|
|
82
|
+
const shown = read ? shownRun(run.font, run.text) : undefined;
|
|
83
|
+
return shown?.reads ? partsShows(run.font, letterTrackedParts(shown, letterTj)) : [{ font: run.font, op: showTextShaped(run.font, run.text, letterTj) }];
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The character spacing a ligature is owed for the letters it joins, as a
|
|
88
|
+
* `TJ` number (thousandths of the font size), for a text of `sizePx`
|
|
89
|
+
* painted under a character spacing of `trackingPx` (#770); 0 when it is
|
|
90
|
+
* owed none.
|
|
91
|
+
*
|
|
92
|
+
* The layout counts the tracking once a letter, and `Tc` follows every
|
|
93
|
+
* glyph: a ligature, one glyph for two or three letters, advanced by one
|
|
94
|
+
* tracking, and the word ended a tracking short of the width measured for
|
|
95
|
+
* each letter joined (`shift` in Source Serif 4 at 19.58 px, 0.39 px a
|
|
96
|
+
* letter: 0.39 px short). In a document shaped in its own language the
|
|
97
|
+
* pen moves on after a ligature by the tracking of its other letters
|
|
98
|
+
* ({@link letterTrackedParts}), as the canvas and the HTML set it; one
|
|
99
|
+
* that keeps the host's language prints as it did.
|
|
100
|
+
*/
|
|
101
|
+
export function letterTrackingTj(trackingPx, sizePx) {
|
|
102
|
+
return trackingPx !== 0 && sizePx > 0 && shapesAsCanvas() ? (trackingPx / sizePx) * 1000 : 0;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The parts of `run` with, after each glyph that stands for several
|
|
106
|
+
* letters ({@link ShownRun.joined}), a pen movement of `letterTj` for
|
|
107
|
+
* each letter but the first: the tracking `Tc` gave the glyph once and
|
|
108
|
+
* the layout counted once a letter. The run's own parts when it holds no
|
|
109
|
+
* such glyph or is not tracked.
|
|
110
|
+
*/
|
|
111
|
+
export function letterTrackedParts(run, letterTj) {
|
|
112
|
+
if (letterTj === 0 || run.joined.length === 0)
|
|
113
|
+
return run.parts;
|
|
114
|
+
const out = [];
|
|
115
|
+
// Glyphs shown so far, and the next entry of `joined` to place.
|
|
116
|
+
let glyph = 0;
|
|
117
|
+
let next = 0;
|
|
118
|
+
for (const part of run.parts) {
|
|
119
|
+
if (typeof part === 'number') {
|
|
120
|
+
pushPart(out, part);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const hex = typeof part === 'string' ? part : part.hex;
|
|
124
|
+
const count = hex.length / 4;
|
|
125
|
+
if (typeof part === 'object') {
|
|
126
|
+
out.push(part);
|
|
127
|
+
for (; next < run.joined.length && run.joined[next][0] < glyph + count; next++)
|
|
128
|
+
pushPart(out, tjNumber(-run.joined[next][1] * letterTj));
|
|
129
|
+
glyph += count;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
let from = 0;
|
|
133
|
+
for (let k = 0; k < count && next < run.joined.length; k++) {
|
|
134
|
+
if (run.joined[next][0] !== glyph + k)
|
|
135
|
+
continue;
|
|
136
|
+
pushPart(out, hex.slice(from * 4, (k + 1) * 4));
|
|
137
|
+
pushPart(out, tjNumber(-run.joined[next][1] * letterTj));
|
|
138
|
+
from = k + 1;
|
|
139
|
+
next++;
|
|
140
|
+
}
|
|
141
|
+
if (from < count)
|
|
142
|
+
pushPart(out, hex.slice(from * 4));
|
|
143
|
+
glyph += count;
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/** The show-text operators of `runs` (`wordRuns`), the runs that follow
|
|
148
|
+
* each other in one file joined into one operator: the pen carries from
|
|
149
|
+
* each to the next, and nothing is kerned across. Undefined when a run's
|
|
150
|
+
* font carries no shaper (a standard font). */
|
|
151
|
+
function joinedShows(runs, read, letterTj = 0) {
|
|
152
|
+
const groups = [];
|
|
153
|
+
for (const run of runs) {
|
|
154
|
+
const shown = inRun(run, () => shownRun(run.font, run.text));
|
|
155
|
+
if (!shown)
|
|
156
|
+
return undefined;
|
|
157
|
+
let group = groups[groups.length - 1];
|
|
158
|
+
if (!group || group.font !== run.font) {
|
|
159
|
+
group = { font: run.font, parts: [] };
|
|
160
|
+
groups.push(group);
|
|
161
|
+
}
|
|
162
|
+
for (const part of letterTrackedParts(shown, letterTj))
|
|
163
|
+
pushPart(group.parts, read || typeof part !== 'object' ? part : part.hex);
|
|
164
|
+
}
|
|
165
|
+
return groups.flatMap((g) => partsShows(g.font, g.parts));
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=textShows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textShows.js","sourceRoot":"","sources":["../../../src/pdf-backend/primitives/textShows.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,8EAA8E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C,GAAG,CAAC,CAAC;IACpI,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
import type { PageTagger } from './tagging.js';
|
|
5
|
-
import type { ResourceImageMap } from './renderResourceBlock.js';
|
|
1
|
+
import { type PDFPage, type Color, type PDFFont } from 'pdf-lib';
|
|
2
|
+
import type { ColorMode } from '../print/colorMode.js';
|
|
3
|
+
import { type CjkRegion, type ScriptContext, type VDTTextDots, type ForcedOrientation } from 'postext';
|
|
4
|
+
import type { PageTagger } from './structure/tagging.js';
|
|
5
|
+
import type { ResourceImageMap } from './blocks/renderResourceBlock.js';
|
|
6
|
+
import type { PdfMatrix } from './primitives/matrix.js';
|
|
7
|
+
export { applyMatrix, pushTransform, popTransform, quarterTurnMatrix, mirrorMatrix, counterFlipPx, composeMatrix, pushFrame, popFrame, mapPointPt, outerRectMap, mapRectThrough } from './primitives/matrix.js';
|
|
8
|
+
export type { PdfMatrix } from './primitives/matrix.js';
|
|
9
|
+
export { drawSwatchPx, drawShapedSwatchPx, fillRectPx, fillRectsPx, drawLinePx, pushClipRect, popClip, pushClipOutline, fillOutlinePx, drawChipBoxPx, strokeOutlinePx } from './primitives/shapes.js';
|
|
10
|
+
export { makeScale, whiteColor, colorFromHex, alphaOf, alphaStateOp, opt, rgbFromHex } from './primitives/color.js';
|
|
11
|
+
export { showTextShaped, textShows, letterTrackingTj } from './primitives/textShows.js';
|
|
12
|
+
export type { TextShow } from './primitives/textShows.js';
|
|
13
|
+
export { textAdvancePx } from './primitives/shapedRuns.js';
|
|
14
|
+
export { cellPieces, measuredTextOperator, measuredTextShows, fontKeyOn } from './primitives/measuredText.js';
|
|
15
|
+
export { pushTextObject, withActualText, beginActualTextSpan, cjkLineText, readText, compressedMarkSpacingPx, endActualTextSpan } from './primitives/actualText.js';
|
|
16
|
+
export type { LineTextState } from './primitives/actualText.js';
|
|
6
17
|
export interface PageCtx {
|
|
7
18
|
page: PDFPage;
|
|
8
19
|
/** Set while a figure label's halo is painted (#860): every text drawn
|
|
@@ -83,209 +94,6 @@ export declare function setTrackingPx(ctx: PageCtx, px: number): void;
|
|
|
83
94
|
* undefined) is just painted.
|
|
84
95
|
*/
|
|
85
96
|
export declare function paintInScript<T>(ctx: PageCtx, script: ScriptContext | undefined, paint: () => T): T;
|
|
86
|
-
/** A PDF transformation matrix `[a b c d e f]` (`x' = a·x + c·y + e`,
|
|
87
|
-
* `y' = b·x + d·y + f`). */
|
|
88
|
-
export type PdfMatrix = [number, number, number, number, number, number];
|
|
89
|
-
/** Apply `m` to a point. */
|
|
90
|
-
export declare function applyMatrix(m: PdfMatrix, x: number, y: number): {
|
|
91
|
-
x: number;
|
|
92
|
-
y: number;
|
|
93
|
-
};
|
|
94
|
-
/** Push a graphics state with `m` concatenated onto the CTM. Everything
|
|
95
|
-
* drawn until {@link popTransform} goes through it. */
|
|
96
|
-
export declare function pushTransform(ctx: PageCtx, m: PdfMatrix): void;
|
|
97
|
-
export declare function popTransform(ctx: PageCtx): void;
|
|
98
|
-
/** The quarter-turn matrix of a turned frame (`VDTResourceRotation`, or
|
|
99
|
-
* a vertical page's flow, `VDTFlowFrame.rotation`) in the backend's
|
|
100
|
-
* points, y up: a frame whose `*Px` helpers flip y against the page
|
|
101
|
-
* height, as the page's own do. */
|
|
102
|
-
export declare function quarterTurnMatrix(rot: {
|
|
103
|
-
direction: 'cw' | 'ccw';
|
|
104
|
-
originX: number;
|
|
105
|
-
originY: number;
|
|
106
|
-
}, scale: number, pageHeightPt: number): PdfMatrix;
|
|
107
|
-
/** The matrix of a right-to-left page's flow (`VDTMirroredFlowFrame`,
|
|
108
|
-
* `mirror.originX` px) in the backend's points: the flow turned over the
|
|
109
|
-
* sheet's vertical axis, `x` → `originX − x`. */
|
|
110
|
-
export declare function mirrorMatrix(originX: number, scale: number): PdfMatrix;
|
|
111
|
-
/** Paint what `paint` draws turned back about the horizontal extent
|
|
112
|
-
* `[leftPx, leftPx + widthPx]` of the current frame, on a mirrored page
|
|
113
|
-
* (`ctx.mirror`): a picture or a formula lands where the mirrored layout
|
|
114
|
-
* put its box and reads unmirrored. Elsewhere it just paints. */
|
|
115
|
-
export declare function counterFlipPx(ctx: PageCtx, leftPx: number, widthPx: number, paint: () => void): void;
|
|
116
|
-
/** `inner` then `outer`: the matrix that maps a point of `inner`'s frame
|
|
117
|
-
* through both. */
|
|
118
|
-
export declare function composeMatrix(inner: PdfMatrix, outer: PdfMatrix): PdfMatrix;
|
|
119
|
-
/** Enter a frame: `m` concatenated onto the CTM ({@link pushTransform}),
|
|
120
|
-
* and the rects and points computed inside it mapped onto the page
|
|
121
|
-
* through it and every frame around it (`ctx.mapRectPt`,
|
|
122
|
-
* {@link mapPointPt}). Frames nest; {@link popFrame} leaves the last. */
|
|
123
|
-
export declare function pushFrame(ctx: PageCtx, m: PdfMatrix): void;
|
|
124
|
-
/** Leave the frame {@link pushFrame} entered last. */
|
|
125
|
-
export declare function popFrame(ctx: PageCtx): void;
|
|
126
|
-
/** A point `(x, y)` in points of the current frame, on the page. */
|
|
127
|
-
export declare function mapPointPt(ctx: PageCtx, x: number, y: number): {
|
|
128
|
-
x: number;
|
|
129
|
-
y: number;
|
|
130
|
-
};
|
|
131
|
-
/** The rect map of the frame around the current one (the page's for a
|
|
132
|
-
* block turned inside a vertical page's flow), or undefined on the
|
|
133
|
-
* page. */
|
|
134
|
-
export declare function outerRectMap(ctx: PageCtx): PageCtx['mapRectPt'];
|
|
135
|
-
/** Map a rect `[x1, y1, x2, y2]` through `m`: the box its four corners
|
|
136
|
-
* cover, min / max (a frame turned by any angle, #910, covers more than
|
|
137
|
-
* the box of two opposite corners). */
|
|
138
|
-
export declare function mapRectThrough(m: PdfMatrix, rect: [number, number, number, number]): [number, number, number, number];
|
|
139
|
-
/** Inline colour swatch (`:swatch{…}`): a square of `sidePx` on the
|
|
140
|
-
* baseline, filled with `fill` (hex) when resolved and outlined in `ink`. */
|
|
141
|
-
export declare function drawSwatchPx(ctx: PageCtx, xPx: number, baselinePx: number, sidePx: number, fill: string | undefined, ink: Color): void;
|
|
142
|
-
/** A swatch with a shape of its own (#1104, see `swatchGeometry`): the
|
|
143
|
-
* fill, then the outline stroked inside the square's edge, both with
|
|
144
|
-
* rounded corners. */
|
|
145
|
-
export declare function drawShapedSwatchPx(ctx: PageCtx, g: SwatchGeometry, fill: string | undefined, ink: Color): void;
|
|
146
|
-
export declare function makeScale(dpi: number): number;
|
|
147
|
-
export declare function whiteColor(colorSpace: ColorMode): Color;
|
|
148
|
-
/**
|
|
149
|
-
* The pdf-lib colour of a document colour string — `#rgb`, `#rrggbb`, with
|
|
150
|
-
* an alpha channel (`#rgba`, `#rrggbbaa`), `rgb()` / `rgba()` or
|
|
151
|
-
* `transparent` — in the output colour space. A translucent colour carries
|
|
152
|
-
* its opacity along (see {@link alphaOf}); malformed input paints black.
|
|
153
|
-
*/
|
|
154
|
-
export declare function colorFromHex(hex: string, colorSpace: ColorMode): Color;
|
|
155
|
-
/** Opacity of a colour made by {@link colorFromHex}, 0 … 1. */
|
|
156
|
-
export declare function alphaOf(color: Color | undefined): number;
|
|
157
|
-
/** The `gs` operator setting constant fill (`ca`) and stroke (`CA`) alpha,
|
|
158
|
-
* one shared ExtGState per pair and page; null when both are opaque. */
|
|
159
|
-
export declare function alphaStateOp(ctx: PageCtx, fillAlpha: number, strokeAlpha?: number): PDFOperator | null;
|
|
160
|
-
/** `op` as a one-element list when set, for spreading into operator runs. */
|
|
161
|
-
export declare function opt(op: PDFOperator | null): PDFOperator[];
|
|
162
|
-
/** Back-compat alias — defaults to RGB. */
|
|
163
|
-
export declare function rgbFromHex(hex: string): Color;
|
|
164
|
-
export declare function fillRectPx(ctx: PageCtx, xPx: number, yPx: number, wPx: number, hPx: number, color: Color, blendMode?: BlendMode): void;
|
|
165
|
-
/** Fill several rectangles (px) in one colour with a single fill operation:
|
|
166
|
-
* the viewer rasterises them as one shape, so rectangles that abut or
|
|
167
|
-
* overlap leave no seam between them. */
|
|
168
|
-
export declare function fillRectsPx(ctx: PageCtx, rects: readonly {
|
|
169
|
-
x: number;
|
|
170
|
-
y: number;
|
|
171
|
-
width: number;
|
|
172
|
-
height: number;
|
|
173
|
-
}[], color: Color): void;
|
|
174
|
-
export declare function drawLinePx(ctx: PageCtx, x1Px: number, y1Px: number, x2Px: number, y2Px: number, color: Color, thicknessPx: number): void;
|
|
175
|
-
/**
|
|
176
|
-
* The show-text operator for `text`, carrying the shaper's glyph positions.
|
|
177
|
-
*
|
|
178
|
-
* pdf-lib's `encodeText` shapes through fontkit but keeps only the glyph
|
|
179
|
-
* ids, so a viewer advances each glyph by its raw width (the `W` array) and
|
|
180
|
-
* the GPOS kerning the canvas measured with is lost: in a tightly kerned
|
|
181
|
-
* face (Geist: `referencia` is 0.21 em narrower kerned) each word paints
|
|
182
|
-
* wider than the layout engine placed it and eats the following space.
|
|
183
|
-
* Emit a `TJ` array instead whose numbers restore every glyph's
|
|
184
|
-
* `xAdvance` / `xOffset`; a run without adjustments stays a plain `Tj`.
|
|
185
|
-
*/
|
|
186
|
-
export declare function showTextShaped(font: PDFFont, text: string, letterTj?: number): PDFOperator;
|
|
187
|
-
/** A show-text operator and the font (a file of the face) it shows in. */
|
|
188
|
-
export interface TextShow {
|
|
189
|
-
font: PDFFont;
|
|
190
|
-
op: PDFOperator;
|
|
191
|
-
}
|
|
192
|
-
/** The show-text operators of `text` in `font`'s face: one
|
|
193
|
-
* ({@link showTextShaped}) for a face of one file, else one per run of
|
|
194
|
-
* characters set in the same file (see `faceFiles.ts`). A glyph the
|
|
195
|
-
* font's `/ToUnicode` map reads as other text is shown in a span of its
|
|
196
|
-
* own ({@link glyphReads}), unless `read` is false: the caller reads the
|
|
197
|
-
* text some other way (an `/ActualText` over all of it, a figure's
|
|
198
|
-
* alternate text).
|
|
199
|
-
*
|
|
200
|
-
* In a document shaped in its own language the text is shaped word by
|
|
201
|
-
* word, as the canvas shaped it (`wordRuns`, #770), and the words that
|
|
202
|
-
* follow each other in one file are one operator; with `whole` it is
|
|
203
|
-
* shaped as one string, as the text of a drawing is (a browser lays an
|
|
204
|
-
* SVG's text out as it does a page's, not as its canvas does). */
|
|
205
|
-
export declare function textShows(font: PDFFont, text: string, read?: boolean, whole?: boolean, letterTj?: number): TextShow[];
|
|
206
|
-
/**
|
|
207
|
-
* The character spacing a ligature is owed for the letters it joins, as a
|
|
208
|
-
* `TJ` number (thousandths of the font size), for a text of `sizePx`
|
|
209
|
-
* painted under a character spacing of `trackingPx` (#770); 0 when it is
|
|
210
|
-
* owed none.
|
|
211
|
-
*
|
|
212
|
-
* The layout counts the tracking once a letter, and `Tc` follows every
|
|
213
|
-
* glyph: a ligature, one glyph for two or three letters, advanced by one
|
|
214
|
-
* tracking, and the word ended a tracking short of the width measured for
|
|
215
|
-
* each letter joined (`shift` in Source Serif 4 at 19.58 px, 0.39 px a
|
|
216
|
-
* letter: 0.39 px short). In a document shaped in its own language the
|
|
217
|
-
* pen moves on after a ligature by the tracking of its other letters
|
|
218
|
-
* ({@link letterTrackedParts}), as the canvas and the HTML set it; one
|
|
219
|
-
* that keeps the host's language prints as it did.
|
|
220
|
-
*/
|
|
221
|
-
export declare function letterTrackingTj(trackingPx: number, sizePx: number): number;
|
|
222
|
-
/** How far `text` moves the pen in `font`'s face at `sizePx`, px, with
|
|
223
|
-
* `trackingPx` after every glyph (as {@link showTextShaped} paints it,
|
|
224
|
-
* each run in the file of the face that has it), and after every letter
|
|
225
|
-
* a ligature joins in a document shaped in its own language
|
|
226
|
-
* ({@link letterTrackingTj}); and how many glyphs it shows. */
|
|
227
|
-
export declare function textAdvancePx(font: PDFFont, text: string, sizePx: number, trackingPx?: number): {
|
|
228
|
-
advance: number;
|
|
229
|
-
glyphs: number;
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* The characters of `text`, a segment of a line of the CJK composer
|
|
233
|
-
* `widthPx` wide, each with its own advance, when the layout measured them
|
|
234
|
-
* one by one and a shaper sets them otherwise together (#770); undefined
|
|
235
|
-
* for any other text, which is painted as it is.
|
|
236
|
-
*
|
|
237
|
-
* The composer measures every CJK character alone and lets the ones that
|
|
238
|
-
* advance alike share a segment, which is then one string to a renderer.
|
|
239
|
-
* A face may kern inside it: Noto Serif JP sets `す。` 0.08 em closer
|
|
240
|
-
* and `れ、` 0.06 em further apart, Noto Sans JP `す。` 0.1 em closer,
|
|
241
|
-
* so the glyphs after the pair stood off their places and the segment
|
|
242
|
-
* ended off its width. A line does not say how its segments were measured,
|
|
243
|
-
* so the PDF asks its own shaper, as it does for the pieces of a word
|
|
244
|
-
* (`wordPieces.ts`): the characters are painted one by one, each where the
|
|
245
|
-
* one before ends, when together they are as wide as the layout measured
|
|
246
|
-
* the segment ({@link cellTolerance}) and nearer to it than the string
|
|
247
|
-
* shaped as the canvas shapes it. A Western run, measured whole, keeps its
|
|
248
|
-
* kerning: whole, it is as wide as it was measured.
|
|
249
|
-
*
|
|
250
|
-
* `trackingPx` is the character spacing the segment is painted with. Only
|
|
251
|
-
* in a document shaped in its own language; one that keeps the host's
|
|
252
|
-
* prints its segments as it always did.
|
|
253
|
-
*/
|
|
254
|
-
export declare function cellPieces(font: PDFFont, text: string, widthPx: number, sizePx: number, trackingPx?: number): Array<{
|
|
255
|
-
text: string;
|
|
256
|
-
width: number;
|
|
257
|
-
}> | undefined;
|
|
258
|
-
/**
|
|
259
|
-
* One show-text operator for a line's pieces (its words and spaces, each
|
|
260
|
-
* with the width the layout measured it at): every piece starts where the
|
|
261
|
-
* layout put it (EF-137). The face's own glyphs set each piece, a `TJ`
|
|
262
|
-
* number after it moves the pen to where the next one starts, so a glyph
|
|
263
|
-
* the embedded face lacks (measured by the browser in another font) or
|
|
264
|
-
* any other difference between the two measures never shifts the words
|
|
265
|
-
* after it. Spaces stay real space glyphs, for text extraction.
|
|
266
|
-
* `trackingPx` is the character spacing (`Tc`) the line is painted with,
|
|
267
|
-
* added after every glyph. Undefined when the font carries no shaper.
|
|
268
|
-
*/
|
|
269
|
-
export declare function measuredTextOperator(font: PDFFont, pieces: readonly {
|
|
270
|
-
text: string;
|
|
271
|
-
width: number;
|
|
272
|
-
}[], sizePx: number, trackingPx?: number): PDFOperator | undefined;
|
|
273
|
-
/**
|
|
274
|
-
* {@link measuredTextOperator} for a face of any number of files: the
|
|
275
|
-
* pieces cut into runs by file (see `faceFiles.ts`), one show-text
|
|
276
|
-
* operator per stretch set in the same file. The pen carries across the
|
|
277
|
-
* font switches, so every piece still starts where the layout put it. A
|
|
278
|
-
* glyph the font's `/ToUnicode` map reads as other text is shown in a span
|
|
279
|
-
* of its own between two of them ({@link glyphReads}).
|
|
280
|
-
*/
|
|
281
|
-
export declare function measuredTextShows(font: PDFFont, pieces: readonly {
|
|
282
|
-
text: string;
|
|
283
|
-
width: number;
|
|
284
|
-
}[], sizePx: number, trackingPx?: number,
|
|
285
|
-
/** False when the caller reads the text some other way: no glyph takes
|
|
286
|
-
* a span of its own (see {@link textShows}). */
|
|
287
|
-
read?: boolean): TextShow[] | undefined;
|
|
288
|
-
export declare function fontKeyOn(page: PDFPage, font: PDFFont): PDFName;
|
|
289
97
|
/** Outline of the glyphs a text is drawn with (a design text's `stroke`):
|
|
290
98
|
* stroked over the fill, or alone for hollow letters. */
|
|
291
99
|
export interface TextOutline {
|
|
@@ -339,104 +147,4 @@ export declare function drawMeasuredTextPx(ctx: PageCtx, pieces: readonly {
|
|
|
339
147
|
text: string;
|
|
340
148
|
width: number;
|
|
341
149
|
}[], xPx: number, baselinePx: number, font: PDFFont, sizePx: number, color: Color, trackingPx?: number, actualText?: string): boolean;
|
|
342
|
-
/**
|
|
343
|
-
* The operators pdf-lib's `drawText` emits, around the show-text operators
|
|
344
|
-
* of a text: one, or one per file of a face made of several (each after
|
|
345
|
-
* its own `Tf`; the pen carries over). With `actualText` the show-text
|
|
346
|
-
* operators sit in a `/Span` marked-content sequence whose `/ActualText` is
|
|
347
|
-
* that text (PDF 1.7 §14.9.4), inside the text object, where readers expect
|
|
348
|
-
* it: copying, text extraction and assistive technology read it instead of
|
|
349
|
-
* the glyphs. The span has no MCID, so in a tagged PDF it nests in the
|
|
350
|
-
* structure sequence open around it.
|
|
351
|
-
*
|
|
352
|
-
* On a mirrored page (`ctx.mirror`) the text matrix turns the glyphs back
|
|
353
|
-
* about the run's box, `[xPx, xPx + advancePx]` (`advancePx`, else the
|
|
354
|
-
* advance {@link drawTextPx} measured): the pen starts at the box's right
|
|
355
|
-
* edge and runs leftwards in the flow, which the page's mirror shows
|
|
356
|
-
* left to right on the sheet.
|
|
357
|
-
*/
|
|
358
|
-
export declare function pushTextObject(ctx: PageCtx, shows: readonly TextShow[], xPx: number, baselinePx: number, font: PDFFont, sizePx: number, color: Color, outline?: TextOutline, actualText?: string, advancePx?: number): void;
|
|
359
|
-
/** `shows` inside a `/Span` whose `/ActualText` is `text`. */
|
|
360
|
-
export declare function withActualText(ctx: PageCtx, text: string, shows: readonly PDFOperator[]): PDFOperator[];
|
|
361
|
-
/**
|
|
362
|
-
* Open a `/Span` marked-content sequence whose `/ActualText` is `text`
|
|
363
|
-
* around everything painted until {@link endActualTextSpan}: a whole line
|
|
364
|
-
* set in pieces. A composed CJK line is painted segment by segment with
|
|
365
|
-
* gaps between them — characters spread for justification, the space
|
|
366
|
-
* between Han and Latin — which text extraction reads as word spaces
|
|
367
|
-
* ("我 们 用 iPhone"); the span gives it the line as written. The tagger's
|
|
368
|
-
* open sequence is closed first, and again before the span ends, so the
|
|
369
|
-
* structure's sequences nest inside it.
|
|
370
|
-
*/
|
|
371
|
-
export declare function beginActualTextSpan(ctx: PageCtx, text: string, state: LineTextState): void;
|
|
372
|
-
/** Where a line's text starts and what it is set in: the face and size of
|
|
373
|
-
* its first text, and that text (which file of a face made of several
|
|
374
|
-
* draws it). */
|
|
375
|
-
export interface LineTextState {
|
|
376
|
-
font: PDFFont;
|
|
377
|
-
text: string;
|
|
378
|
-
sizePx: number;
|
|
379
|
-
xPx: number;
|
|
380
|
-
baselinePx: number;
|
|
381
|
-
}
|
|
382
|
-
/** The text a composed CJK line is read as when its segments are painted
|
|
383
|
-
* apart (see {@link beginActualTextSpan}): the segments' text, when one
|
|
384
|
-
* of them carries tracking, is a Han–Latin space, is a mark that gave up
|
|
385
|
-
* blank (its glyph painted over its neighbour's box, `inkOffset`), hangs,
|
|
386
|
-
* is a ruby base (the line reads its base, not the reading painted over
|
|
387
|
-
* it), a warichu note's part (read once, upper row first) or a character
|
|
388
|
-
* with kanbun marks (read with its 送り仮名, {@link readText}); else
|
|
389
|
-
* undefined. */
|
|
390
|
-
export declare function cjkLineText(segments: readonly {
|
|
391
|
-
text: string;
|
|
392
|
-
tracking?: number;
|
|
393
|
-
autospace?: boolean;
|
|
394
|
-
inkOffset?: number;
|
|
395
|
-
hangs?: boolean;
|
|
396
|
-
ruby?: unknown;
|
|
397
|
-
warichu?: unknown;
|
|
398
|
-
kunten?: {
|
|
399
|
-
okuri?: string;
|
|
400
|
-
};
|
|
401
|
-
}[]): string | undefined;
|
|
402
|
-
/** A segment's text as it is read: a character with kanbun marks (#430)
|
|
403
|
-
* is followed by its 送り仮名 (`學ビテ`, as kanbun is typed with them);
|
|
404
|
-
* its 返り点 are reading-order marks, left out. */
|
|
405
|
-
export declare function readText(s: {
|
|
406
|
-
text: string;
|
|
407
|
-
kunten?: {
|
|
408
|
-
okuri?: string;
|
|
409
|
-
};
|
|
410
|
-
}): string;
|
|
411
|
-
/**
|
|
412
|
-
* The character spacing (`Tc`, px) a CJK mark that gave up blank is shown
|
|
413
|
-
* with (`inkOffset` set): painted `-inkOffset` before its box, its glyph
|
|
414
|
-
* then advances to where its segment ends, so the box a reader gives the
|
|
415
|
-
* glyph (its advance plus `Tc`) never runs over the next character's —
|
|
416
|
-
* poppler read a compressed `:` over the `「` after it as a line break.
|
|
417
|
-
* Undefined for any other segment, or when the font cannot measure it.
|
|
418
|
-
*/
|
|
419
|
-
export declare function compressedMarkSpacingPx(font: PDFFont, seg: {
|
|
420
|
-
text: string;
|
|
421
|
-
width: number;
|
|
422
|
-
inkOffset?: number;
|
|
423
|
-
inkScale?: number;
|
|
424
|
-
}, sizePx: number): number | undefined;
|
|
425
|
-
/** Close the span {@link beginActualTextSpan} opened, with the line's text
|
|
426
|
-
* state in force (see `lineTextState`). */
|
|
427
|
-
export declare function endActualTextSpan(ctx: PageCtx, state: LineTextState): void;
|
|
428
|
-
export declare function pushClipRect(ctx: PageCtx, xPx: number, yPx: number, wPx: number, hPx: number): void;
|
|
429
|
-
export declare function popClip(ctx: PageCtx): void;
|
|
430
|
-
/** Push a graphics state clipped to a rounded outline (px); undo with
|
|
431
|
-
* {@link popClip}. */
|
|
432
|
-
export declare function pushClipOutline(ctx: PageCtx, o: RoundedOutline): void;
|
|
433
|
-
/** Fill a rounded outline (px). */
|
|
434
|
-
export declare function fillOutlinePx(ctx: PageCtx, o: RoundedOutline, color: Color): void;
|
|
435
|
-
/** The box of an inline chip (`:chip[…]`) whose segment starts at `xPx` on
|
|
436
|
-
* a line of baseline `baselinePx`: the fill, then the outline stroked
|
|
437
|
-
* inside the box edge (the text runs are painted by the caller). */
|
|
438
|
-
export declare function drawChipBoxPx(ctx: PageCtx, chip: VDTChip, xPx: number, baselinePx: number): void;
|
|
439
|
-
/** Stroke a rounded outline (px) `thicknessPx` wide, centred on it. */
|
|
440
|
-
export declare function strokeOutlinePx(ctx: PageCtx, o: RoundedOutline, color: Color, thicknessPx: number): void;
|
|
441
|
-
export {};
|
|
442
150
|
//# sourceMappingURL=primitives.d.ts.map
|