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
Adds opt-in re-subsetting for embedded fonts that already carry an ABCDEF+ subset prefix tag (CompressOptions.reSubsetTaggedFonts(boolean)). Default behavior continues to skip tagged producer subsets while allowing callers to reclaim extra space when needed under existing safety gates.
Changed:
Add reSubsetTaggedFonts option to CompressOptions and thread it through PdfCompressor, QpdfLib, JpdfiumLib, and jpdfium_qpdf_subset_fonts in jpdfium.h/jpdfium_qpdf.cpp.
Update GraalVM reachability metadata JSON files for the updated native downcall signature.
Add opt-in re-subsetting verification tests in PdfCompressorTest.
PDF compression now offers an opt-in setting to re-subset fonts that have already been subsetted. By default, those fonts remain unchanged, preserving existing behavior. Enable the setting when you want compression to process tagged fonts again.
The change adds an opt-in for re-subsetting fonts with existing subset tags and passes it through the Java and native font-subsetting interfaces. It also adds an integration test and closes page handles used during text comparisons.
Changes: Tagged font subsetting
Layer / File(s)
Summary
Option and Java-to-native forwarding jpdfium/src/main/java/stirling/software/jpdfium/doc/CompressOptions.java, jpdfium/src/main/java/stirling/software/jpdfium/doc/PdfCompressor.java, jpdfium/src/main/java/stirling/software/jpdfium/panama/QpdfLib.java, jpdfium/src/main/resources/META-INF/native-image/.../reachability-metadata.json, reachability-metadata/metadata/.../reachability-metadata.json
CompressOptions adds reSubsetTaggedFonts, which defaults to false. PdfCompressor passes the value to QpdfLib, which forwards it through the native binding.
The native subsetting entry point accepts the option. Tagged fonts remain skipped when it is false; when true, recognized tags are removed before subsequent processing.
Tagged-font integration test jpdfium/src/test/java/stirling/software/jpdfium/doc/PdfCompressorTest.java
The test checks the default behavior, initial font subsetting, and the explicit re-subsetting option.
Page-handle closure
Layer / File(s)
Summary
Close page handles after text comparison jpdfium/src/main/java/stirling/software/jpdfium/doc/PdfCompressor.java
sameText obtains both pages as PdfPage handles and closes them after comparing extracted text.
Possibly related PRs
Stirling-Tools/JPDFium#253: Adds the native font-subsetting entry point and Java binding that this change extends with the tagged-font option.
Change: Feature
Merge Risk: Moderate · previous review 9e04f
The new tagged-font option changes the native function signature without bumping the ABI version. A mismatched native library would then be accepted at load time and could crash the process instead of failing cleanly. The new test also would not detect the option being ignored. Bump the ABI version and tighten the test before merging.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: an opt-in option that re-subsets fonts already carrying a subset tag. The changeset adds CompressOptions.reSubsetTaggedFonts, threads it through PdfCompressor and Qpdf…
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.
Description check
The description follows the template's Description of Changes section with a clear summary of the opt-in re-subsetting option and the files it threads through. Checklist items are mostly ticked. One i…
Full details: Title check
Explanation
The title names the main change: an opt-in option that re-subsets fonts already carrying a subset tag. The changeset adds CompressOptions.reSubsetTaggedFonts, threads it through PdfCompressor and QpdfLib, and updates the native bridge. The title matches the changeset and the PR objectives. Minor naming mismatch: the description and objectives refer to subsetTaggedFonts(boolean), while the code uses reSubsetTaggedFonts. This does not affect the title's relevance.
Full details: Description check
Explanation
The description follows the template's Description of Changes section with a clear summary of the opt-in re-subsetting option and the files it threads through. Checklist items are mostly ticked. One item is unchecked: the CHANGELOG.md entry under Unreleased. The PR also contains a mismatch: the description names CompressOptions.reSubsetTaggedFonts(boolean), while the PR objectives name CompressOptions.subsetTaggedFonts(boolean). The description also lists the Javadoc and version-reference checks as done without showing evidence of them. It does not include an explicit 'Closes #' issue reference, although the template comment asks for one.
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.
Review details
Context from checks skipped due to timeout: 44
GitHub Check: README Quick Start Example (Linux x64)
GitHub Check: Unit & Integration E2E Tests (Linux x64)
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 opt-in re-subsetting for embedded fonts that already carry an
ABCDEF+subset prefix tag (CompressOptions.reSubsetTaggedFonts(boolean)). Default behavior continues to skip tagged producer subsets while allowing callers to reclaim extra space when needed under existing safety gates.Changed:
reSubsetTaggedFontsoption toCompressOptionsand thread it throughPdfCompressor,QpdfLib,JpdfiumLib, andjpdfium_qpdf_subset_fontsinjpdfium.h/jpdfium_qpdf.cpp.PdfCompressorTest.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