You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cover FontNormalizer ToUnicode and width repair - #258
Adds unit and integration tests covering FontNormalizerToUnicode synthesis, FreeType width repair, surrogate pairs, explicit /CIDToGIDMap streams, and zero-advance glyphs. Verifies normalization behavior end-to-end through the public Java API while hardening native ToUnicode scanning edge cases.
Changed:
Add FontNormalizerTest cases for simple/CID ToUnicode synthesis, non-BMP surrogate pairs, explicit /CIDToGIDMap streams, and width repair.
Harden CMap parsing and zero-advance width handling in jpdfium_advanced.cpp.
Improved PDF font normalization so text mappings are recognized across multiple mapping sections, and recoverable character mappings are retained for CID fonts.
Improved CID font width handling by accepting numeric default widths, including fractional values, and rounding them to whole units.
Added regression coverage for font mappings and widths, including PDFs with forms and annotation appearances, and checks for repeatable normalization.
Native font normalization now scans additional CMap sections, adjusts synthesized CID-to-Unicode mappings, and rounds numeric CID default widths. Integration-gated tests cover simple and CID font repairs, document normalization, and related PDF scenarios.
The native code scans all CMap mapping sections and adjusts synthesized mappings for non-CID-keyed fonts. Tests cover generated mappings, multiple CMap sections, WinAnsi differences, and PDF fixtures.
Simple and CID font width repair native/bridge/src/jpdfium_advanced.cpp, jpdfium/src/test/java/stirling/software/jpdfium/fonts/FontNormalizerTest.java
The native code rounds numeric CID default widths. Tests cover repaired and preserved widths, zero-width CIDs, and PDF inspection helpers and fixtures.
Integration-gated tests cover combined normalization, idempotence, fonts in forms and annotation appearances, and stale open pages after document rewrites.
Change: Other
Merge Risk: Low · previous review 262cd
The font normalization changes are small and bounded. The new multi-section CMap test does not actually exercise the scanning fix, so a future regression there could go unnoticed. Add same-type empty-then-populated bfchar and bfrange cases to close the gap.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Cover FontNormalizer ToUnicode and width repair" names the main change. The PR adds tests for FontNormalizer ToUnicode synthesis and width repair, and it hardens native CMap parsing and zer…
Description check
The description summarizes the change, lists the added tests and native hardening, and completes most checklist items. It omits the changelog entry and the Javadoc review, and it leaves the ABI note i…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Cover FontNormalizer ToUnicode and width repair" names the main change. The PR adds tests for FontNormalizer ToUnicode synthesis and width repair, and it hardens native CMap parsing and zero-advance width handling. The title does not mention the native changes, which are secondary.
Full details: Description check
Explanation
The description summarizes the change, lists the added tests and native hardening, and completes most checklist items. It omits the changelog entry and the Javadoc review, and it leaves the ABI note item unchecked without explanation. The template's 'Closes #(issue number)' line is also absent. These gaps are non-critical, so the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Learnt from: CR
Repo: Stirling-Tools/JPDFium PR: 0
File: .github/CODERABBIT_REVIEW.md:0-0
Timestamp: 2026-10-20T15:53:18.441Z
Learning: Source excerpt:
# JPDFium review standards
## Tests, profiling, and delivery
- Every defect fix needs a focused regression with an observable expected result. No `assertTrue(true)`, swallowed failures, or tests that silently pass when fixtures/tools/source roots are missing.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Use a second section of the same mapping type.
This fixture has an empty bfchar followed by a populated bfrange. The immediate-base implementation already checks the first section of each type, so this test passes without the scanning fix. (raw.githubusercontent.com)
Use an empty bfchar followed by a populated bfchar. Add the equivalent bfrange case. Both cases must preserve the existing mapping and report zero repairs only with the fix.
As per coding guidelines, “Every defect fix needs a focused regression with an observable expected result.”
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Adds unit and integration tests covering
FontNormalizerToUnicodesynthesis, FreeType width repair, surrogate pairs, explicit/CIDToGIDMapstreams, and zero-advance glyphs. Verifies normalization behavior end-to-end through the public Java API while hardening nativeToUnicodescanning edge cases.Changed:
FontNormalizerTestcases for simple/CIDToUnicodesynthesis, non-BMP surrogate pairs, explicit/CIDToGIDMapstreams, and width repair.jpdfium_advanced.cpp.Checklist
General
## [Unreleased]inCHANGELOG.mdLibrary changes
.github/workflows/compatibility.ymlexcludes the break with a reasondocs/installation.md, and the POMsNative or FFM changes
bash native/build-real.sh)./gradlew :jpdfium:integrationTestnative/bridge/include/jpdfium.hand the ABI notes for any ABI changeTesting
./gradlew :jpdfium:integrationTestpasses