Repository navigation
fix(pdf): extract Adobe small capitals as letters - #1200
Merged
Merged
Conversation
Fonts with glyphs such as `Asmall` or `oneoldstyle` map them to Adobe's corporate-use code points U+F721 to U+F7FF, so the text layer held private-use characters that no search found and no copy could read. These code points mirror ASCII and Latin-1 at U+F700. Fold them back when a shown string is resolved to text, as pdf.js does. The glyphs drawn stay the same. Fixes #1187 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5yx1nDeVcNX3BxqK1WpJz
andiwand
added a commit
that referenced
this pull request
Oct 10, 2026
The output now masks a JPEG image with its soft mask (#1201), and extracts Adobe small capitals as letters (#1200). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5yx1nDeVcNX3BxqK1WpJz
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.
Fixes #1187
Fonts with glyphs such as
Asmalloroneoldstylemap them to Adobe's corporate-use code points (the Adobe Glyph List givesAsmallU+F761,oneoldstyleU+F731). The text layer then held private-use characters, so a search did not find the word and a copy gave unreadable characters.Change
Adobe's code points U+F721 to U+F7FF mirror ASCII and Latin-1 at U+F700:
AsmallU+F761 →a,AgravesmallU+F7E0 →à,zerooldstyleU+F730 →0.resolve_textin the page extractor folds them back when it turns a shown string into text, as pdf.js does. This changes only the text, so the selection layer and text extraction get the letters. The visual layer draws glyphs, so the rendering stays the same. An author's/ActualTextstays as written. Symbol fonts use U+F020 to U+F0FF, so they are not affected.Verification
PdfPageExtractor.adobe_small_caps_extract_as_letters:/DifferencestoAsmall,Bsmall,oneoldstyleand a plainDgivesab1D. Without the change, the test fails withU+F761 U+F762 U+F731 D.Reference output
The private PDF whose title showed the problem changes. I will update the reference output after this PR and the #1188 PR have landed.