Skip to content

v1.0.1 — Fix CP1252 bullet encoding

Choose a tag to compare

@Nizoka Nizoka released this 23 Apr 11:45
· 13 commits to main since this release
2f6e8be

v1.0.1 — Fix CP1252 bullet encoding

This is a patch release fixing a regression where bullet list items rendered
as ? in the default WinAnsi/Helvetica mode, and completing the full CP1252
character set for the toWinAnsi() encoding function.

No API changes. No breaking changes. Upgrade is a drop-in replacement.


Bug Fixes

fix(encoding): bullet list items rendered as ? in default mode ([#1])

Every { type: 'list', style: 'bullet' } block without fontEntries
(the default Helvetica/WinAnsi mode) produced ? instead of in the
generated PDF.

Root cause: toWinAnsi() in src/fonts/encoding.ts was missing the
CP1252 mapping for the bullet character (U+2022 → 0x95).
The list renderer in pdf-renderers.ts hard-codes '\u2022' as the bullet
marker, which must survive toWinAnsi() — the absent mapping caused every
default-mode bullet list to render ? instead.

Fix: Added U+2022 → \x95 to toWinAnsi().

Note for users with fontEntries: this bug does not affect CIDFont /
Identity-H mode — glyph IDs are resolved directly from the font cmap
and toWinAnsi() is never called. Only default Helvetica mode was impacted.


fix(encoding): complete CP1252 0x80–0x9F character table

CP1252 defines 27 characters in the 0x80–0x9F range that are absent from
ISO-8859-1. v1.0.0 mapped only 8 of them (€ – — ' ' " " …). This release
adds the remaining 18:

Unicode Char CP1252 Description
U+2022 0x95 Bullet (primary fix)
U+201A 0x82 Single low-9 quotation mark
U+0192 ƒ 0x83 Latin small f with hook
U+201E 0x84 Double low-9 quotation mark
U+2020 0x86 Dagger
U+2021 0x87 Double dagger
U+02C6 ˆ 0x88 Modifier letter circumflex accent
U+2030 0x89 Per mille sign
U+0160 Š 0x8A Latin capital S with caron
U+2039 0x8B Single left-pointing angle quotation mark
U+0152 Œ 0x8C Latin capital ligature OE
U+017D Ž 0x8E Latin capital Z with caron
U+02DC ˜ 0x98 Small tilde
U+2122 0x99 Trade mark sign
U+0161 š 0x9A Latin small s with caron
U+203A 0x9B Single right-pointing angle quotation mark
U+0153 œ 0x9C Latin small ligature oe
U+017E ž 0x9E Latin small z with caron
U+0178 Ÿ 0x9F Latin capital Y with diaeresis

All of these previously fell through to the ? replacement path. This fix
is purely additive — no existing mapping has changed.


fix(docs): landing page live demo content

The live demo on pdfnative.dev used (U+2713)
in table cells. This character has no CP1252 equivalent and cannot be
encoded in WinAnsi mode — it rendered as ?. Replaced with ASCII Yes.

Unrelated financial API properties (type: 'credit', pointed: false)
that were incorrectly included in the buildDocumentPDFBytes() demo have
also been removed.


Testing

  • 1600 tests passing (up from 1588 in v1.0.0)
  • 12 new test cases covering U+2022 → \x95 and all 18 additional
    CP1252 0x80–0x9F mappings added in this release
  • 141 sample PDFs regenerated — bullet lists visually verified

Upgrading

npm install pdfnative@1.0.1

No code changes required. This release is a transparent drop-in upgrade.


Full Changelog

v1.0.0...v1.0.1