Fix subset font rendering in both Acrobat and Illustrator#117
Open
diaconu-andrei wants to merge 5 commits intoprawnpdf:masterfrom
Open
Fix subset font rendering in both Acrobat and Illustrator#117diaconu-andrei wants to merge 5 commits intoprawnpdf:masterfrom
diaconu-andrei wants to merge 5 commits intoprawnpdf:masterfrom
Conversation
According to PDF spec section 5.5.3, font subset tags must be 6 uppercase letters. This converts the hex digest (0-9a-f) to uppercase letters: - Digits 0-9 map to letters A-J - Hex a-f map to letters K-P This maintains 1-to-1 deterministic mapping while satisfying the PDF spec requirement for 6 uppercase letters. Fixes both Adobe Acrobat (issue prawnpdf#102) and Adobe Illustrator warnings. Fixes: prawnpdf#102 Related: prawnpdf#107 Made-with: Cursor
|
Thanks for opening this @diaconu-andrei! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes subset font compatibility issues that caused corrupted text rendering in Adobe Illustrator while keeping Acrobat working correctly
Changes:
cmap table: Added a Mac Roman (platform 1, encoding 0) subtable alongside the existing Windows Unicode subtable. Illustrator needs this to resolve glyph IDs back to characters when editing embedded font text (without it, it falls back to treating glyph IDs as raw character codes, producing garbled output)name table: The PostScript name tag is now generated as 6 uppercase letters per PDF spec §5.5.3 (digits map to A–J, hex letters map to K–P). More importantly, the subset now mirrors the platform records the original font already has for the PostScript name (name ID 6) instead of always writing a Mac Roman record. Illustrator requires a Windows UTF-16BE (platform 3) record; blindly adding a platform 1 record to fonts that never had one caused Illustrator to misread the subset and render corrupted text.Test: Updated the expected name table checksum to reflect the new Windows UTF-16BE PostScript name record.