Skip to content

v1.8.0 — typography, 27 scripts, CMYK & PDF/X-4

Choose a tag to compare

@Nizoka Nizoka released this 15 Sep 13:06
· 4 commits to main since this release
69d6a5f

pdfnative v1.8.0

Released 2026-09-15

The typography and print release. Long reports now typeset like documents rather than generated pages: paragraphs break across pages under widow and orphan rules, headings stay with what they introduce, body text justifies with hanging punctuation, and a registered font's pair kerning and OpenType figures apply on request. Five scripts of mainland South-East Asia join (27 in all), two of them shaped by a Universal Shaping Engine generated from the Unicode Character Database. Colour emoji gain every COLRv1 transform, variable paints and structural masks, so flags keep their shaded wave, and the bundled module carries skin tones. For print, colours can be CMYK, OutputIntents can be CMYK or Gray without breaking a PDF/A claim, printer's marks use the registration colour, and a document can claim PDF/X-4 and check itself with validatePdfX(). Devanagari, Bengali, Tamil, Telugu and Sinhala are shaped by one OpenType engine that applies the font's own features in the order the Indic specification prescribes — reph, half forms, subjoined consonants and pre-base vowel signs now land where the font designed them — and every font module keeps one mark-anchor class per subtable, so vowel signs, harakat, niqqud and tone marks sit at their designed height in all 27 scripts. Hausa, Yoruba, Igbo and Swahili render on the bundled Noto Sans with their combining tone marks attached. Underneath, every sample is deterministic and held byte for byte to the release that last changed it, and twenty-nine one-page language documents put every construction of a script in front of a reader who can judge it. Backward-compatible with v1.7.0 — 58 exports added and none removed; every new capability is a new API or an opt-in option; existing inputs render byte-identically except where the previous output was wrong, and every such case, plus the four calls whose behaviour changed, is listed under Upgrade. Zero runtime dependencies, 3824+ tests across 160 files, and a consumer importing one helper now bundles that helper alone (2.6 KB for parseColor, down from 29.8 KB, with the bundle gate now set at 4 KB).

Highlights

  • Typography — layout.typography adds paragraph splitting with widows / orphans, keepHeadingsWithNext, align: 'justify' and opticalMargins, soft hyphens and a setHyphenationProvider() seam with hyphenationLanguage, ISO 80000-1 unit binding, punctuation-spacing presets and rules, exact base-14 metrics, pair kerning, and fontFeatures such as onum and smcp (with a diagnostic when a tag changes nothing). New typography guide.
  • 27 scripts and a Universal Shaping Engine — Lao, Tai Tham, New Tai Lue, Tai Le and Cham, with the engine's categories derived from UCD 17.0.0 and one shaper registry in place of three dispatch ladders. Khmer subscripts, Myanmar kinzi and stacked marks render correctly.
  • Indic OpenType engine — Devanagari, Bengali, Tamil, Telugu and Sinhala share one engine that reads the font's per-script GSUB features (rphf, blwf, half, pstf, vatu, cjct, pres, abvs, blws, psts, haln, contextual lookups included) and applies them per syllable in specification order; the reph sits over the consonant that follows the base, the Tamil i-matra stays to the right of its consonant, Telugu subjoined consonants appear, and every vowel sign takes the anchor its font declares. A rendering report on the Hindi, Tamil and Telugu samples started this work; the text-shaping rules describe the pipeline.
  • Latin combining marks and four African languages — a latin-marks shaper attaches free-standing combining marks through the font's ccmp and GPOS anchors, so Yoruba ẹ́ ọ̀, Igbo ị́ and NFD text set in Noto Sans render composed; Hausa (ɓ ɗ ƙ ƴ), Yoruba, Igbo and Swahili sample plates and documents ship, all on the bundled latin module — no new font, no new key.
  • Language conformance documents — twenty-nine one-page samples (doc-thai … doc-polish), one for every bundled script (the Japanese and Chinese documents already existed) and one for each of the four African languages, each with an edge-case table (what it exercises, the sample, what a correct rendering shows) held to one page by a test and to pixels by a visual baseline.
  • Colour emoji — COLRv1 transforms (formats 12–31), variable paints at the default instance, SRC_IN / DEST_IN masks as clipping paths; 150 bundled skin-tone forms.
  • CMYK and PDF/X-4 — [c, m, y, k] colours, CMYK and Gray OutputIntents with RGB content kept conforming through a calibrated /DefaultRGB (veraPDF-validated under PDF/A-1b and 2b), registration-colour marks, pdfx: 'pdfx4', and validatePdfX(). See the print guide.
  • Regression harness — npm run verify:samples holds all 292 samples to the bytes of the release that last changed them and refuses two samples of a pair that come out identical, blocking in CI; npm run verify:bundle proves the published bundle tree-shakes; npm run gate runs every check with a twenty-line summary.

Added

  • feat(samples): setDefaultCreationDate() / getDefaultCreationDate(); npm run verify:samples with a SHA-256 manifest (byte mode, or a semantic projection for the 14 encrypted samples) whose entries carry the release each hash was captured at; .github/workflows/sample-regression.yml.
  • feat(core): typography options splitParagraphs, orphans, widows, keepHeadingsWithNext, unitBinding, punctuationSpacing, opticalMargins, metrics, fontFeatures, kerning; block-level keepWithNext and splittable; ParagraphBlock.align: 'justify'; bindUnits(), applyPunctuationSpacing(), DEFAULT_UNITS, PUNCTUATION_SPACING_PRESETS, setHyphenationProvider() / getHyphenationProvider().
  • feat(shaping): Lao (shapeLaoText(), buildLaoClusters()), Tai Tham, New Tai Lue, Tai Le and Cham with their detection predicates and font modules; the Universal Shaping Engine (useCategory(), useCategories(), splitUseSyllables(), reorderUseCluster(), shapeUseText(), USE_UNICODE_VERSION); SCRIPT_SHAPERS and findShaper(); npm run verify:unicode.
  • feat(fonts): COLRv1 transform, variable and mask paints; build-time clip compaction; ClipOutline; 150 bundled skin-tone sequences and the CLI --sequences skin preset; npm run verify:fonts, which rebuilds every font module from its declared source and compares byte for byte.
  • feat(core): CMYK colours (PdfCmykTuple, PdfCmykString, PdfColorSpace, ResolvedColor, resolveColor(), fillOp(), strokeOp()); CMYK and Gray OutputIntents; PDFA_DEVICE_CMYK_CONTENT; pdfx: 'pdfx4' with PDF_X_CONFORMANCE_TARGETS, PdfXConformanceTarget and the PDFX_NO_FONT_ENTRIES, PDFX_DEVICE_CMYK, PDFX_ANNOTATIONS diagnostics; registration-colour printer's marks; setDeflateRawImpl() and wrapZlib().
  • feat(core): colour control bars — print.marks.colourBars (true, or { tints, size }) paints cyan, magenta, yellow and black at 100 % and 50 % as DeviceCMYK patches in the bottom bleed strip, 12 pt by default and clamped to the strip; use a 5 mm bleed (3 mm leaves 7.5 pt patches, below a densitometer aperture). Off by default, and existing marks are byte-identical. Under tagged, the whole marks block is /Artifact << /Type /Page >> BDC … EMC (ISO 32000-1 Table 330: cut marks and colour bars), so assistive technology and text extractors skip it.
  • feat(parser): validatePdfX() and PdfXValidationResult — header, XMP identification, OutputIntent profile, page boxes, embedded fonts (page resources, Form XObjects and patterns), annotations (Hidden, NoView and Popup exempt), actions and JavaScript, the LZWDecode filter, transfer functions, halftones, interpolated images and device colour.
  • feat(parser): extractText() honours /ActualText on marked content, so tagged output extracts as the characters the writer declared.
  • feat(shaping): the Indic OpenType engine behind shapeDevanagariText(), shapeBengaliText(), shapeTamilText(), shapeTeluguText() and shapeSinhalaText() — syllables split from the Unicode Character Database's cluster categories, base and reph found by asking the font which forms it has, per-glyph feature masks, the basic features locl ccmp nukt akhn rphf rkrf pref blwf abvf half pstf vatu cjct applied one stage each, final reordering, the presentation features pres abvs blws psts haln calt, then mark attachment; GSUB lookup types 1, 2, 4 and the contextual 5 and 6, lookupFlag IgnoreMarks through GDEF. A font registered without the new otl tables takes the same path over its flat ligatures and gsub maps.
  • feat(shaping): shapeLatinMarksText() and the latin-marks entry of SCRIPT_SHAPERS (last in dispatch order, so every run another shaper claims is untouched): ccmp under latn/DFLT, mark-to-base, mark-to-mark. detectCharLang() routes Latin Extended-B, IPA Extensions and the combining-mark blocks to latin, and Bengali and Tamil to bn and ta; a base letter followed by a combining mark stays in one font run when that font anchors the mark.
  • feat(fonts): every font module carries otl — { gsub: { scripts, lookups, sets? }, gdef? }, the per-script, per-feature layout tables with Extension lookups resolved — beside the unchanged gsub, ligatures, features and kern exports; OtlTables, OtlLookup and OtlChainRule are exported types and FontData.otl is optional. compileFontData() emits the same bytes as tools/build-font-data.cjs, now proven by a synthetic-font parity test that runs the CLI.
  • feat(core): ShapedGlyph.cps — the source code points behind a shaped glyph; the encoding context writes them into the ToUnicode CMap as multi-code-point bfchar destinations, so a conjunct, a subjoined form or a composed mark extracts as its letters in untagged output too.
  • feat(core): PDFA_ICC_PROFILE_VERSION diagnostic — an ICC v4 (or later) OutputIntent under a PDF/A-1b claim, which ISO 19005-1 §6.2.2 restricts to v2 profiles; silent under PDF/A-2 and PDF/A-3, where v4 is allowed (ISO 19005-2 §6.2.4.2).
  • feat(parser): validatePdfX() also checks fonts inside annotation appearance streams (/AP /N, /R, /D), rejects OPI dictionaries, PostScript XObjects (/Subtype /PS or /Subtype2 /PS), reference XObjects (/Ref) and embedded files (/EmbeddedFiles name tree, /FileAttachment annotations, /EmbeddedFile streams), and accepts only /TR2 /Default where it tolerated /TR /Identity.
  • feat(samples): twenty-nine one-page language conformance documents generated from scripts/data/language-docs-data.ts (title, introduction, edge-case table, list, footer, per language), locked by tests/regression/language-docs.test.ts (exactly one page through inspectDocumentLayout(), no missing glyph in any sample, English labels) and by seven new visual baselines; four alphabet plates and four documents for Hausa, Yoruba, Igbo and Swahili (292 samples in all).
  • feat(tooling): scripts/glyph-names.ts names glyph ids from a font's post table (--name searches), the companion of shapeIndicTextTraced() when a golden test needs a human-readable expectation.
  • feat(core): TYPOGRAPHY_FEATURE_INEFFECTIVE diagnostic for a fontFeatures tag no registered font declares, or that substitutes no glyph; typography.hyphenationLanguage, passed to the hyphenation provider as its second argument.
  • feat(core): typography.bindShortWords (true, or { maxLength, words }) replaces the space after a one-letter word — or after each word of an explicit list such as Polish ['w', 'z', 'i', 'a', 'o', 'u'] — with a no-break space, so a line never ends on "a", "w" or "I"; a house style rather than a law (orthography in Polish, Czech, Slovak, Russian, Ukrainian and Hungarian; no English authority forbids it), hence opt-in and visible to text extraction. bindShortWords() is exported alongside bindUnits(). typography.keepHeadingsWithNext also accepts { minLines } to reserve at least N lines of the following paragraph on the heading's page (default 2, as before; three is a common house style); the reservation never drops below orphans, and { minLines: 2 } is byte-identical to true.
  • feat(types): every 1.8.0 option object is a named, exported type — TypographyOptions, UnitBindingOptions, PunctuationSpacingRule, PunctuationSpacingPreset, Base14Metrics and the new ColourBarOptions (the object form of marks.colourBars) join PrintOptions, PrinterMarksOptions, CustomOutputIntent and PdfXConformanceTarget in src/index.ts, so a TypeScript consumer can name a typography or colour-bar configuration without indexing into PdfLayoutOptions.
  • feat(agents): the machine-readable contracts an autonomous agent reads first — docs/data/errors.json now carries every code of the PdfDiagnosticCode union and a buildErrors list of the messages the builders throw (PDF/X coherence, print geometry, OutputIntent profile), each with its remedy; docs/data/surfaces.json and the choose guide gain the 1.8.0 rows (typography, CMYK colour, CMYK/Gray OutputIntent, PDF/X-4, validatePdfX, colour bars, reproducible output) with an honest note on every surface that does not expose them yet; a new docs/data/playgrounds.json inventories the twelve playgrounds (URL, purpose, DOM control ids, options exercised, preconditions); docs/agent-brief.md and llms.txt describe the 1.8.0 surface and the four behaviour changes.
  • feat(tooling): npm run gate (--fast, --ci, --publish, --only, --json) as the single quality gate; npm run verify:bundle; scripts/release-prepare.ts for the mechanical part of a version bump; --quiet / --json on the sample generator and the veraPDF runner; CLAUDE.md and a committed .claude/settings.json for Claude Code sessions.
  • feat(samples): 50 new samples (292 in all), including a hyphenation-provider sample, and two executable recipes, typography-report and print-pdfx4.

Changed

  • refactor(core): one pagination planner for the builder and inspectDocumentLayout(); one colour-operator choke point for 101 call sites.
  • refactor(shaping): one shaper registry; the hand-written fall-through that shaped any unmatched run as Devanagari is gone.
  • perf(fonts): pair kerning stored in OpenType class form — 46 KB for Noto Sans instead of 594 KB expanded, so modules keep their pre-kerning size and parse time.
  • feat(core): parseColor() also accepts CMYK inputs; outputIntent also accepts CMYK and Gray profiles and is resolved before any byte is written.
  • perf(bundle): the Universal Shaping Engine builds its grammar on first use, initCrypto() imports statically, and every module-level table carries a purity annotation, so a consumer's bundler keeps only what it imports.
  • feat(core): every date the writer stamps — /CreationDate, /ModDate, xmp:CreateDate, xmp:ModifyDate, the {date} placeholder and, through them, the trailer /ID — is formatted in UTC with a literal +00'00' / +00:00 offset, whatever the host time zone. A pinned creationDate therefore yields the same bytes on every machine; output under TZ=UTC is byte-identical to 1.7.0.
  • feat(parser): validatePdfX() rejects any /TR transfer function and any /TR2 other than /Default; 1.7.0 tolerated /TR /Identity.
  • chore(deps): js-yaml pinned to 4.3.2 through overrides (GHSA-2883-xcg3-v3hh, reached only through ESLint); packageManager pins npm.
  • chore(deps): vitest and @vitest/coverage-v8 move to 4.1.11 and @humanfs/node (reached through ESLint) to 0.16.8, closing the two moderate advisories npm audit reported against the development tree (GHSA-82fw-gwwq-j7x9, GHSA-p498-v437-472g); the same 4.x line, nothing ships to consumers, npm audit is clean.
  • chore(ci): ci.yml and publish.yml run scripts/gate.ts with the new --require-all flag (a step the gate would skip — veraPDF or the source fonts missing — fails instead) rather than listing steps by hand; every job starts with step-security/harden-runner in audit mode; npm ci --ignore-scripts everywhere, with .npmrc (ignore-scripts, fund=false, audit-level=high) and .node-version beside .nvmrc. The publish job waits for the npm-publish environment, serialises through a concurrency group, checks the tag against package.json, installs veraPDF through a composite action that verifies the installer's SHA-256, downloads the source fonts from the commit pinned in fonts/SOURCES.json, upgrades npm to exactly 11.19.1 (Node 22 ships npm 10.9, which cannot use Trusted Publishing) and publishes with --provenance; a second job attaches a CycloneDX SBOM, the tarball and their build-provenance attestations to the GitHub release the maintainer created. New dependency-review.yml (high severity, licence allow-list) and a weekly audit.yml; a tag ruleset (.github/rulesets/tags.json) forbids deleting or moving v* tags. All of it locked by tests/tools/workflows.test.ts.
  • chore(fonts): fonts/SOURCES.json pins the google/fonts commit, the SHA-256 and the copyright statement of every source TTF; npm run fonts:download refuses a file whose hash drifted and npm run verify:fonts checks the sources before rebuilding; the four hinted static instances (Arabic, Armenian, Georgian, Hebrew) are pinned to their notofonts release archives (repository, tag, asset, entry, SHA-256) and extracted by the script with node:zlib; the five Latin subsets (Cyrillic, Greek, Polish, Turkish, Vietnamese) are cut from the pinned NotoSans-VF.ttf by the library's own subsetTTF() — a declared code-point list per module under fonts/subsets/, the recorded command npx tsx scripts/build-latin-subsets.ts, the resulting SHA-256 in derived[] — so no font binary is committed to the repository any more, and verify:fonts re-derives the subsets before comparing their modules, proving every bundled module from upstream bytes. The historical pyftsubset files are gone with their unrecorded invocation; the Cyrillic one, it turned out, had been cut from a hinted static build rather than from the variable font its manifest entry named.
  • feat(fonts): subsetTTF() accepts an optional third argument, { keepLayoutTables: true }, which copies GSUB, GPOS and GDEF verbatim for a subset meant as a source font rather than a PDF embed (valid because glyph ids are retained; the caller keeps the GSUB closure of its glyphs). The two-argument call is byte-identical to 1.7.0. Internal surface, used by scripts/lib/latin-subsets.ts.
  • chore(repo): .gitattributes declares * text=auto eol=lf and marks the generated bulk (fonts/*-data.js, use-data.ts, the llms files, api.json, the guide shells, the lockfile) linguist-generated; the eol-lf rule of verify:docs reports the 315 files still stored with CRLF as warnings until the maintainer's renormalisation commit flips it to failing; npm run hooks:install sets up an opt-in pre-commit (lint, no CRLF) and pre-push (fast gate) pair; the pull-request template mirrors the CONTRIBUTING checklist word for word (pr-template-parity); tsup --silent.
  • chore(agents): .claude/settings.json bounds Bash output and timeouts and denies the generated bulk files and git push; .claude/hooks/guard.mjs is import-safe, fails closed and refuses publish, PR, issue, release, tag and push commands inside any segment, subshell or interpreter payload (tests/tools/guard.test.ts, 108 cases); .claude/rules/*.md are generated from .github/instructions/*.md by npm run agents:rules and checked by claude-rules-sync / claude-rules-budget; the release-audit skill packages the two-auditor, one-verifier protocol; agent-config-parity and skills-shape keep the configuration honest; .github/ai-governance.json describes the Claude Code capabilities.
  • chore(verify): verify:docs checks more of what the docs claim — the diagnostic-code registry against the whole PdfDiagnosticCode union and the thrown build-time messages, package versions in Markdown table rows and in the homepage badge, script and playground counts (word numerals included), declared.tests against the last gate run and declared.bundledFontModules against fonts/, the current release note's presence in llms.txt, and the playgrounds manifest; docs/llms-index.json carries a SHA-256 per page; the bundle-size budgets sit 50 % above the measured figures instead of 3×.

Fixed

  • fix(core): AcroForm /DR font embedded under a PDF/A claim, so interactive forms can be archival (#74).
  • fix(core): inspectDocumentLayout() reported fewer pages than the build for documents with a table of contents (#75).
  • fix(core): setDeflateImpl() documentation recommended implementations that produce unreadable streams; injected compressors are now validated (#78).
  • fix(core): soft hyphens rendered as visible hyphens; no-break spaces measured about twice their width.
  • fix(fonts): GSUB single substitutions read from the wrong offset, missed extension lookups and merged discretionary features; font modules advertised glyphs a subsetted face could not draw.
  • fix(shaping): Khmer subscripts, Myanmar kinzi and stacked marks; U+061C ARABIC LETTER MARK stripped before measuring.
  • fix(fonts): the font-module generators collapsed every GPOS mark class to class 0 and kept only the last MarkToBase subtable's bases, so in twelve modules an above-base vowel sign took a below-base anchor (Devanagari े on व sat on the baseline, Tamil ூ floated onto the next glyph, Khmer and Myanmar above marks were 630 units low); Extension (type 9) positioning lookups were skipped. Mark classes are now unique across subtables and a mark carries one anchor triple per subtable that covers it.
  • fix(shaping): the Tamil shaper treated ி (U+0BBF) as a pre-base vowel sign and drew விலை as வெலை; the Devanagari and Bengali shapers emitted the reph before the base with a post-base offset formula, so प्रदर्शन lost its reph and समर्थन read समथन; the Telugu shaper never consulted GSUB, so ప్రదర్శన had no subjoined forms; Devanagari ो and ौ were split into two glyphs the font draws as one; a greedy ligature driver could not tell a rphf result from a blwf result of the same input pair. All five shapers now run on the Indic engine, and tests/shaping/indic-real-font.test.ts holds the words of the report on the bundled fonts.
  • fix(shaping): Bengali and Tamil text had no language branch in detectCharLang(), so a multi-font document sent them to the first registered font that covered the code point.
  • fix(fonts): head.checkSumAdjustment in every embedded subset is computed (0xB1B0AFBA − Σ file) instead of written as zero, as ISO/IEC 14496-22 §5.2.3 requires; rasterisers ignore the field, strict font validators do not.
  • fix(tools): compileFontData()'s CommonJS output omitted the features and kern tables its ESM output carried.
  • fix(fonts): COLRv1 sweep-angle bias; seven transform formats that sent their glyph to monochrome.
  • fix(core): colour-emoji gradient layers whose stops share one colour and fade only in alpha (Noto's soft shadows and vignettes) were painted as a flat opaque disc, turning 👩, 👨, 🧑, 😊, 🌍, 🎂, 🏳️‍🌈 and about fifty other glyphs into silhouettes; such layers are omitted until luminosity soft masks land, and a single-colour gradient paints as its solid.
  • fix(core): base-14 text is measured once, not encoded twice — the CP1252 marks (— … “ ” ‘ ’) and invisible bidi controls measured at the 556-unit default, so right- and centre-aligned lines containing them missed their margin and an opening quote hung too far.
  • fix(core): a no-break space (U+00A0) or narrow no-break space (U+202F) reaches a registered font that has the glyph instead of being folded to an ordinary space, so punctuationSpacing: 'fr' is distinguishable from 'fr-CA' and the character extracts as written.
  • fix(core): keepHeadingsWithNext reserves the lines the paragraph splitter will actually place (orphans, and a table's trailer), so a heading is no longer stranded when splitParagraphs is on.
  • fix(core): the PDF/X TrimBox synthesised for a page with a bleedBox and no trimBox is the BleedBox, not the MediaBox.
  • fix(core): printer's marks keep at least max(weight, 0.5) pt clear of both the trim line and the sheet edge; at a 3 mm bleed the registration cross and the crop marks ended exactly on the TrimBox line and exactly on the MediaBox edge, so a viewer's page border or the guillotine took their outer half. Targets are re-centred and shrunk to fit, and dropped below a 6.6 pt strip rather than drawn clipped.
  • fix(fonts): glyphs introduced by fontFeatures are embedded, listed in /W and mapped in ToUnicode; they rendered blank before.
  • fix(fonts): embedded subsets keep the source font's prep, fpgm, cvt and gasp tables (copied verbatim, never synthesised), so hinting rasterisers retain dropout control and grid-fitting: thin diagonals such as the lowercase w of Noto Sans no longer render greyish at small sizes. Outlines are byte-identical; the cost is 48 bytes for most bundled faces and at most 4.2 KB for the hinted Cyrillic, Math, Georgian, Armenian, Arabic, Hebrew and Tai Le faces.
  • fix(core): justified text keeps its space glyphs and writes one TJ array per line.
  • fix(core): an OutputIntent profile is checked for the ICC acsp signature and a size field within the buffer, in the writer (layout.outputIntent) and in validatePdfX(); a 200-byte buffer that merely spelt CMYK at byte 16 was accepted as a press profile before.
  • fix(samples): sample output depended on the machine's locale — amounts were formatted with a bare toLocaleString().
  • fix(parser): the inline-dictionary skip in extractText() consumed the operator following >>.
  • fix(samples): the typography showcase used straight apostrophes and quotes, stripped accents and breakable thousands separators, and two of its pairs were byte-identical files.
  • fix(fonts): the GSUB single-substitution parser (offset, extension lookups, discretionary features) is locked by a synthetic-font test rather than by the publish-only font rebuild.
  • fix(shaping): the Thai and Lao shapers appended the nikhahit of a decomposed sara am (ำ U+0E33, ຳ U+0EB3) after the tone mark already on the consonant, so in น้ำ or ນ້ຳ the nikhahit was drawn on top of the tone; the nikhahit is now ordered before the cluster's tone marks, as the Thai OpenType specification and HarfBuzz's preprocess_text_thai do, and the tone stacks on it through the font's own mark-to-mark anchor. Noto Sans Lao's pali virama U+0EBA, which the font sets as a 210-unit spacing sign with no anchor, was emitted at zero advance under the following glyph and vanished; an unanchored below sign now keeps the advance the font gives it. No other shaper synthesises a mark out of order — Khmer, Myanmar, the Indic engine, the Universal Shaping Engine and the Latin combining-mark shaper attach marks in text order. Reported by a Thai reader of the language conformance documents.
  • fix(samples): the Thai language document's "Silent and tone-less marks" row claimed a repetition mark and showed ฯลฯ, the abbreviation sign; it now sets ๆ (mai yamok, U+0E46) beside ฯ and the thanthakhat, and its "Tone mark over a vowel" row shows only words where a tone sits on a vowel sign. The Lao document's Pali-virama row no longer promises what Noto Sans Lao cannot draw (the font anchors no mark for U+0EBA) and shows the repetition and abbreviation signs ໆ and ຯ instead; its tone-over-vowel and sara am rows are corrected the same way. doc-thai and doc-polish join the visual baselines.

Documentation

  • docs(guides): new typography guide; the print guide covers CMYK, CMYK OutputIntents, registration colour, PDF/X-4 and validatePdfX() (and lists what the validator does not check); the PDF/A, colour-emoji and text-extraction guides describe what 1.8.0 renders and extracts; the self-verify, debugging, troubleshooting and agentic-workflows guides cover validatePdfX(), reproducible bytes, TYPOGRAPHY_FEATURE_INEFFECTIVE, the PDF/X coherence errors and the setDeflateImpl() change; 32 guides (28 at v1.7.0), 17 recipes (none at v1.7.0).
  • docs(readme): the compression recipe no longer recommends fflate's raw deflateSync (the input setDeflateImpl() now rejects); the API reference lists every 1.8.0 export; the ecosystem table says 1.8.0.
  • docs(site): the homepage gains a typography / CMYK / PDF/X-4 card and says 27 scripts everywhere; the playgrounds cover the 1.8.0 scope — the all-scripts world tour renders all 27 scripts, the typography playground adds short-word binding, minLines, hyphenation and exact metrics presets and shows the diagnostics channel, the print playground runs its CMYK and PDF/X-4 presets on a bundled synthetic profile (a real job still needs the printer's .icc) and shows the coherence errors, the inspect playground validates a dropped file against PDF/X-4, and every code view has a copy button.
  • docs(language): the project language is English, now written down in AGENTS.md, CONTRIBUTING.md and the Copilot rules and enforced by the prose-language rule of verify:docs and by the regression suite (generators, sample data, benchmarks, tests): the typography samples, the signature sample, the benchmark fixture and a few test fixtures that were French are English; the soft-hyphen and hyphenation-provider samples demonstrate on English words with an English syllable rule; the only French left is the sentence the fr punctuation preset acts on, marked demo-language: fr. The guard recognises French, Spanish, Italian, Portuguese and German prose and UTF-8-as-Latin-1 mojibake, with Unicode word boundaries and lowercase-only function words so proper names such as Noto Sans Tai Le pass; sample data records in other scripts and languages (Thai, Arabic, Turkish, Vietnamese, Polish…) are demonstration content by nature and carry their own lang label.
  • docs(site): the Open Graph image and the GitHub social preview are re-rasterised from their SVG sources (headless Chromium, 1200 × 630 and 1280 × 640), which had moved on since the PNGs were last generated; their subtitle now names typography and CMYK / PDF/X-4.
  • docs(instructions): the text-shaping rules describe the Indic OpenType engine (pipeline, masks, reordering, limits), the Latin combining-mark shaper, the otl module format and the anchor-triple format; the README, FAQ, text-extraction, PDF/A, print and self-verify guides, the homepage, the learn path, the agent brief and llms.txt say what 1.8.0 shapes, which diagnostics exist, what validatePdfX() checks, and that dates are UTC.
  • docs(samples): the 27 alphabet plates size their columns to the widest label across every script (no more … truncation of Pre-base vowels, Final consonants and tones, Composed with the base) and paint the glyph-category column in the neutral text colour instead of the financial table's red/green: red is reserved for a failing test.
  • docs(meta): roadmap moves seven closed workstreams to Released (the Latin subsets built by the library among them) and restates what remains; AGENTS.md condensed, CLAUDE.md added, CONTRIBUTING.md gains the release procedure and the download-and-derive font chain; counts and versions are verified against docs/assets/ecosystem.json in every agent-facing file; documentation re-audited as of 2026-09-15.
  • docs(licences): THIRD-PARTY-NOTICES.md names every source font with its upstream (google/fonts commit or notofonts release tag) and its copyright statement, states that the bundled modules are OFL Modified Versions built by pdfnative from sources that are downloaded and hash-checked rather than committed, records the Reserved Font Name "Source" the three Noto Sans CJK fonts inherit from Source Han Sans (never used by pdfnative), names Unicode 17.0.0 and the HarfBuzz commit of the USE override tables, and acknowledges the Adobe Core 14 AFM metrics behind the base-14 widths — which the previous "no other third-party code or data" sentence had missed. fonts/LICENSE carries the copyright line of every Noto family, as OFL §2 requires; a test holds both files to fonts/SOURCES.json.
  • docs(discoverability): the package description and keywords, the homepage description, Open Graph and Twitter cards and JSON-LD (keywords, featureList, applicationSubCategory), llms.txt and CITATION.cff name the 1.8.0 surface — typography, CMYK and PDF/X-4, the Indic and Universal shaping engines, Lao, Tai Tham and Cham, Hausa, Yoruba, Igbo and Swahili, COLRv1, reproducible output.
  • docs(guides): the text-extraction guide states how a Thai or Lao sara am extracts (decomposed in untagged output, exact through /ActualText under a tagged level); the text-shaping rules describe the nikhahit ordering and the unanchored-sign rule; the font-engineering rules, CONTRIBUTING and the README development section describe the download-and-derive chain now that nothing binary is committed.

Install

npm install pdfnative@1.8.0

Upgrade

No public API was removed or renamed. Drop-in replacement for v1.7.0 for every program that does not rely on the four behaviours below, and output is byte-identical for existing inputs except where the previous output was wrong.

Four calls behave differently:

  • setDeflateImpl() validates the compressor it is given and throws, at build time, when the function returns raw DEFLATE (RFC 1951) instead of zlib-wrapped data (RFC 1950) — the 1.7.0 documentation recommended fflate's deflateSync, which is raw, and a document built with it was unreadable. Pass a zlib-producing function (zlibSync, node:zlib deflateSync), or a raw one to the new setDeflateRawImpl(). (#78)
  • parseColor() accepts four values as CMYK — a percent tuple or a four-operand string. parseColor([0, 0, 0, 100]) and parseColor('0 0 0 1') both threw in 1.7.0 and return '0 0 0 1' now; code that relied on the throw to reject four-element input must check the length itself.
  • extractText() returns the /ActualText of a marked-content span instead of the glyphs shown inside it. Text extracted from tagged pdfnative output, or from any tagged PDF, can therefore differ from 1.7.0 — it now matches what the writer declared.
  • The {date} header and footer placeholder follows layout.creationDate (or the process-wide setDefaultCreationDate()) instead of the wall clock, so a pinned build renders the pinned date. A document that sets creationDate and uses {date} therefore changes bytes; one that sets neither does not. Dates are written in UTC (D:20260101000000+00'00', 2026-01-01T00:00:00+00:00), so the same instant yields the same bytes on every host; a build that relied on the host zone appearing in /CreationDate — a +02'00' offset, or a {date} that rolled over at local midnight — sees the UTC form instead.

One input is rejected that was accepted before: layout.outputIntent.iccProfile must carry the ICC acsp signature and a size field no larger than the buffer. Real profiles do; a hand-made stub that only spelt a colour space at byte 16 now throws at build time.

Deliberate output changes — each was wrong before, and each moved sample is re-anchored to 1.8.0 in tests/regression/baselines/samples.sha256.json:

  • Khmer and Myanmar text — subscript consonants now use their subscript glyphs, a kinzi no longer takes horizontal space, and a second mark on one base sits on the first instead of over it.
  • Tai Tham and Cham text set with a font you registered yourself is shaped by the Universal Shaping Engine; 1.7.0 bundled no font for either and took the plain per-codepoint path.
  • Colour-emoji flags carry their shaded wave; glyphs built on COLRv1 transforms render in colour instead of monochrome.
  • Text using fonts whose single substitutions were mis-read — notably CJK faces and Lao — now gets the glyphs the font specifies, and discretionary alternates (aalt, stylistic sets, small caps) no longer apply unasked.
  • Soft hyphens no longer render mid-word, and lines containing no-break spaces measure correctly, so they can wrap differently.
  • A no-break space in text set with a registered font (Noto Sans has the glyph) is emitted as U+00A0 and extracts as U+00A0; it was folded to an ordinary space before. Same advance in Noto Sans, so nothing moves — four pdfa-latin samples with 1 000-style figures are re-anchored.
  • Right- and centre-aligned base-14 text containing — … “ ” ‘ ’ or an invisible bidi control now lands on its margin; the estimate measured those characters at 556 units. parser/text-extract-report and stress/table-micro-columns are re-anchored.
  • signature/digital-signature-info.pdf — the note inside the sample quotes Adobe Reader's English strings instead of the French ones; a sample-text change only, re-anchored to 1.8.0.
  • alphabet/*.pdf (27 plates) — wider columns and neutral type labels; presentation of the sample only, no engine change; all re-anchored to 1.8.0.
  • Every document drawing print.marks — crop marks and registration targets now stop 0.5 pt short of the trim line and the sheet edge; print/print-bleed-marks, print-cmyk-pdfx4 (which also gains colour bars at a 5 mm bleed), print-cmyk-pdfa2b and print-explicit-boxes are re-anchored.
  • Colour emoji whose COLRv1 artwork ends in an alpha-only gradient (about fifty glyphs, 👩 and 👨 among them) lose the opaque disc that hid their face and keep the artwork underneath; the soft shadow itself is not rendered until 1.9. emoji/color-emoji-basic, color-emoji-sequences and color-emoji-skin-tones are re-anchored.
  • Every PDF that embeds a TrueType subset changes bytes twice over while its glyph outlines do not: the subset keeps the source's hinting tables (prep, fpgm, cvt , gasp) when the source carries them, and its head.checkSumAdjustment is computed instead of zero. Every such sample is re-anchored, and a downstream byte-comparison pipeline should expect the same.
  • Documents embedding the Cyrillic, Greek, Polish, Turkish or Vietnamese modules — the five source subsets are now cut from the pinned NotoSans-VF.ttf by subsetTTF() instead of the historical pyftsubset files. Greek, Polish, Turkish and Vietnamese keep the same glyph ids, cmap, widths and outlines; their embedded subsets gain Noto Sans's 7-byte prep and 8-byte gasp tables (48 bytes per PDF). The Cyrillic face changes more: its previous subset had been cut from a hinted static build, so it now carries the variable font's default-instance outlines without TrueType instructions (same contours), the variable font's 4 515 glyph ids instead of 3 884 (every /W array and glyph code moves) and the full Noto Sans kerning, otl and mark-anchor tables. The twenty samples set in those faces — alphabet/alphabet-{cyrillic,greek,polish,turkish,vietnamese}, document/doc-{cyrillic,greek,polish,turkish,vietnamese,multi-language}, diverse/diverse-{library-el,menu-tr,train-pl,weather-vi}, financial/sample-{el,tr,vi,pl,multi} — are re-anchored to 1.8.0; a doc-polish visual baseline locks the outlines.
  • Thai and Lao sara am under a tone mark (น้ำ, ก่ำ, ນ້ຳ) — the nikhahit is drawn before the tone in the glyph stream so the tone stacks on it (it sat under the nikhahit before); the Lao pali virama U+0EBA keeps its advance beside its base instead of vanishing under the next glyph. diverse/diverse-recipe-th, document/doc-thai, document/doc-lao and alphabet/alphabet-lao are re-anchored, the lao and doc-lao visual baselines re-rasterised, and a doc-thai baseline added. Untagged extraction of a decomposed ำ yields four code points for น้ำ (no nu, the two stacked marks in geometric order, sara aa), never U+FFFD; tagged output extracts the source text through /ActualText.
  • Every script with mark positioning — Arabic, Hebrew, Thai, Lao, Khmer, Myanmar, Tibetan, Devanagari, Bengali, Tamil, Telugu, Sinhala, Tai Tham, Cham, and Latin, Cyrillic or Greek text with anchored diacritics — takes its vowel signs, harakat, niqqud, tone marks and stacked marks from the anchor class the font designed for them. Above-base marks that sat on the baseline or on a below-base anchor move to their designed height; text that was already right keeps its position but its font module's data changed. Every alphabet plate, language document, shaping, extreme, bidi, diverse and financial sample set in those fonts is re-anchored.
  • Devanagari, Bengali, Tamil, Telugu and Sinhala text is shaped by the Indic OpenType engine: the Tamil i-matra ி stays to the right of its consonant and only ெ ே ை (and the pre-base halves of ொ ோ ௌ) move left; the reph of प्रदर्शन, समर्थन or কর্ম sits over the consonant after the base, at zero advance; Telugu subjoined consonants and vattu appear (ప్ర, స్త్ర); conjuncts, half forms and rakar come from the font's own akhn, half, cjct, blwf and vatu features rather than from a flat ligature list; Devanagari ो and ौ are one glyph; a virama that no form absorbs stays visible. hi, bn, ta, te, si samples and every multi-script sample containing them are re-anchored.
  • Latin text with free-standing combining marks set in a registered font that anchors them (Noto Sans) renders composed instead of as a base followed by a spacing mark; text without such marks, and text set in the base-14 fonts, is untouched.
  • ToUnicode CMaps of documents whose shaper produced a conjunct, a subjoined form or a composed mark now map that glyph to its source code points as a multi-code-point bfchar; extraction of those clusters no longer yields U+FFFD in untagged output. The CMap stream changes bytes for every affected sample.
  • The twenty-nine language documents (doc-thai, doc-bengali, doc-tamil, doc-devanagari, doc-telugu, doc-sinhala, doc-tibetan, doc-khmer, doc-myanmar, doc-amharic, doc-arabic, doc-hebrew and the four new African ones) are one-page conformance pages generated from a data table; their text changed by design.
  • Documents registering the Polish, Turkish or Vietnamese subsets fall back to another registered font for characters those subsets cannot draw, instead of rendering blanks.
  • inspectDocumentLayout() reports the same page count as the build when a table of contents is present.

Two options ship with a known limit, documented in the typography guide: punctuationSpacing: 'fr' needs a registered font to render its narrow no-break space (WinAnsi has none, so base-14 output degrades to 'fr-CA'), and fontFeatures: ['tnum'] or ['lnum'] change nothing with the bundled Noto Sans, whose figures are tabular and lining by default — the new TYPOGRAPHY_FEATURE_INEFFECTIVE diagnostic says so.

The Indic engine has known limits too, documented in the text-shaping rules: GSUB alternate (type 3) and reverse-chaining (type 8) lookups are not applied, a mark-filtering-set flag is treated as "skip no mark", pair kerning is not applied inside a shaped run, variable fonts are read at their default instance, and Gujarati, Gurmukhi, Kannada, Malayalam and Odia have no bundled font (a font you compile yourself with compileFontData() carries its otl tables, but no shaper is registered for those scripts yet).

Downstream integration notes

For pdfnative-cli, pdfnative-mcp and pdfnative-react, which pin ^1.7.0 and therefore resolve to 1.8.0:

  • Type widening. PdfColor now includes PdfCmykTuple and PdfCmykString, and PdfDiagnosticCode gains six codes (PDFA_DEVICE_CMYK_CONTENT, PDFA_ICC_PROFILE_VERSION, PDFX_NO_FONT_ENTRIES, PDFX_DEVICE_CMYK, PDFX_ANNOTATIONS, TYPOGRAPHY_FEATURE_INEFFECTIVE). Code that switches exhaustively over PdfDiagnosticCode with a never check will need the new cases; the union is additions-only by contract. The option types a wrapper re-exposes are all named exports now (TypographyOptions, ColourBarOptions, PrinterMarksOptions, PrintOptions, CustomOutputIntent).
  • New layout options to expose: typography (including hyphenationLanguage), pdfx, and CMYK or Gray outputIntent profiles. pdfx and tagged are mutually exclusive and throw together. Two value shapes need schema work too: colour fields now accept a four-element CMYK tuple or a 'c m y k' string (a hex-or-RGB schema, or a lint rule typed for RGB, rejects them), and print.marks accepts the object form { colourBars: true | { tints, size } } beside true. docs/data/surfaces.json records which surface exposes what.
  • New error messages to classify. The PDF/X coherence errors start with PDF/X or layout.pdfx (layout.pdfx and layout.tagged cannot be combined, PDF/X forbids encryption, PDF/X-4 requires layout.outputIntent, PDF/X-4 requires an output (printer) profile, PDF/X requires the trapping state to be known, PDF/X pages carry a TrimBox or an ArtBox, not both, layout.pdfx: unknown target); a CLI or server that maps print., chart: and outputIntent. prefixes to an input-error code should add those two prefixes, or the errors surface as runtime failures. All of them, with the outputIntent. and print. messages, are served verbatim in docs/data/errors.json under buildErrors, so a classifier can be generated rather than hand-written.
  • Hand-enumerated surfaces to refresh. pdfnative-cli's --font allow-list, its --strict help text and its schema descriptions enumerate the bundled scripts by hand (22 today); pdfnative-mcp's lang enum likewise. Adding lo, nod, khb, tdd and cjm is a change in those repositories, not a consequence of the engine bump.
  • {date} and creationDate. A wrapper that exposes creationDate (pdfnative-mcp does on its nine document tools) now also pins the {date} placeholder, and every date is written in UTC, so a pinned build is byte-identical across hosts without a TZ pin; document that alongside the reproducible-output promise. A wrapper test that asserted a local-zone offset in /CreationDate needs +00'00'.
  • Four language keys, no new font. ha, yo, ig and sw are sample labels over the bundled latin module; a CLI --font latin or an MCP lang: 'latin' already renders Hausa, Yoruba, Igbo and Swahili with their tone marks attached. A surface that maps language codes to modules can alias the four to latin rather than add entries.
  • Shaped-glyph provenance. ShapedGlyph gains an optional cps (source code points); a consumer that constructs ShapedGlyph values by hand needs no change, one that re-implements ToUnicode generation can read it.
  • FontData.otl. Optional on the type, so hand-built or 1.7.0-era font objects still register; a font compiled with 1.8.0's compileFontData() or shipped in pdfnative/fonts/* carries it. markAnchors.marks[gid] and mark2Classes[gid] are flat triples [class, x, y, class, x, y, …] (one per subtable) instead of a single [x, y, class]; code reading a bundled module's anchors directly must iterate.
  • New validator. validatePdfX() sits beside validatePdfUA() for verify commands and tools. It reports errors 1.7.0 did not: fonts inside annotation appearances, OPI, PostScript and reference XObjects, embedded files, any /TR transfer function; a file that passed the 1.7.0 validator can fail the 1.8.0 one for one of those reasons.
  • HyphenationProvider now receives (word, lang?); a provider written against the one-argument shape keeps working.
  • Font modules were regenerated: they carry kern, features and otl tables, corrected GSUB data, and mark anchors with one class per subtable. Consumers that vendor module files should refresh them. Sizes move with the anchors that were previously dropped and the layout tables that are new: Noto Sans 2 937 → 3 177 KB, Devanagari 917 → 1 043 KB, Tibetan 2 855 → 2 978 KB, Cyrillic 1 018 → 1 352 KB (the whole Noto Sans kerning and anchor tables now travel with it, since its source is cut from the variable font), Bengali 654 → 704 KB, Telugu 1 495 → 1 525 KB, Sinhala 1 657 → 1 669 KB; the Greek, Polish, Turkish and Vietnamese modules are within 1 KB of their previous size, the other modules grow by 1–21 KB and the two emoji modules are unchanged.
  • subsetTTF(ttf, gids, options?). A third, optional argument ({ keepLayoutTables }) selects the source-font mode the bundled Latin subsets are built with; existing two-argument calls are byte-identical. subsetTTF is not part of the public entry point, so a wrapper needs no change.
  • Licence files. fonts/LICENSE and THIRD-PARTY-NOTICES.md (both in the tarball) now list every Noto copyright holder, the Reserved Font Name of the CJK fonts and the Adobe Core 14 metrics; a downstream package that copies pdfnative's notices into its own should refresh them.
  • Colour-emoji module grows to 4 969 KB with skin tones.
  • Script count is 27; surfaces that enumerate scripts should add Lao, Tai Tham, New Tai Lue, Tai Le and Cham (lo, nod, khb, tdd, cjm).
  • Bundle size. The published dist/index.js tree-shakes per export; a tool that bundles pdfnative can drop its own workarounds for the previously retained crypto and shaping tables.

Links