Skip to content

墨痕归卷,字库随行 · Bundle CJK fallback fonts for PDFium - #55

Merged
eric8810 merged 2 commits into
mainfrom
codex/fix-pdf-font-fallback
Jul 30, 2026
Merged

墨痕归卷,字库随行 · Bundle CJK fallback fonts for PDFium#55
eric8810 merged 2 commits into
mainfrom
codex/fix-pdf-font-fallback

Conversation

@eric8810

@eric8810 eric8810 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • bundle the checksum-pinned official Noto Sans SC regional subset and its OFL license in every native npm platform package
  • rebuild the exact reviewed pdfium-native 0.6.1 addon so PDFium initializes from the package-local font directory
  • add a deterministic non-embedded STSong-Light fixture that gates font selection, rendered PNG content, and end-to-end Chinese OCR
  • advance the immutable release closure to Core/native 0.5.6, runtime 0.1.6, Document 0.1.2, and Tiny/Medium 0.1.5

Why

The 0.5.5 packages include PDFium but no fallback fonts. A PDF that references a Chinese font without embedding glyphs can therefore become blank or tofu-like during rendering before OCR sees the page. This change closes that renderer dependency inside npm and keeps install/runtime free of secondary downloads.

The official SC regional subset preserves the tested fallback behavior while reducing the per-platform font payload from 16.44 MB to 8.33 MB unpacked and from about 13.59 MB to 7.20 MB in the npm tarball.

Validation

  • macOS arm64 real PDFium render: STSong-Light -> Noto Sans SC, non-empty PNG
  • end-to-end default model OCR: 中文测试
  • Unicode installation-path loader smoke
  • 17 Python release/patch/CI contract tests
  • all workspace Node tests
  • strict TypeScript typecheck
  • git diff --check

Six-platform package smoke remains the required CI evidence before release.

eric8810 added 2 commits July 28, 2026 08:53
Bundle a checksum-pinned Noto Sans CJK SC font in every native npm package and initialize the reviewed PDFium source against that package-local directory.

Gate non-embedded Chinese rendering and OCR in the offline six-platform package smoke, and advance the release closure to conservative patch versions.
Use the official Noto Sans SC regional subset instead of the full language-specific CJK font.

Preserve the locked offline fallback contract and real Chinese OCR smoke while reducing the compressed npm payload from about 13.6 MB to 7.2 MB per platform.
@eric8810
eric8810 merged commit 196ebde into main Jul 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant