Read a symbolic TrueType font, so a scanned-era form says something - #11
Merged
Conversation
…hing extract v0.3.0 reads a symbolic TrueType font through its own character map. A font flagged symbolic, with an embedded FontFile2 and neither /Encoding nor /ToUnicode, used to yield no text at all — so the text of a document set in one came back as a handful of stray characters. Measured through this module's own front door: pdfops text -pages 1 1999-schedule-i.pdf 10 -> 1 103 words pdfops text -pages 1 1999-schedule-d.pdf 10 -> 312 words pdftotext finds 1 105 and 314 on the same two pages. The two words are the price of being stricter than the reference: neither poppler nor pdf.js consults the character map for text — both default such a font to WinAnsiEncoding names and hope — while this reports the character of the glyph that is actually drawn, and stays silent where the font gives it no honest answer. Across 118 843 arXiv PDFs not one byte of extracted text changes, and across the 1 633 real forms four files gain text and none loses any. pdffont v0.3.1 comes along, and where it applies ops v0.7.1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
extract v0.3.0 reads a symbolic TrueType font through its own character map. A
font flagged symbolic, with an embedded FontFile2 and neither /Encoding nor
/ToUnicode, used to yield no text at all — so the text of a document set in one
came back as a handful of stray characters.
Measured through this module's own front door:
pdfops text -pages 1 1999-schedule-i.pdf 10 -> 1 103 words
pdfops text -pages 1 1999-schedule-d.pdf 10 -> 312 words
pdftotext finds 1 105 and 314 on the same two pages. The two words are the
price of being stricter than the reference: neither poppler nor pdf.js consults
the character map for text — both default such a font to WinAnsiEncoding names
and hope — while this reports the character of the glyph that is actually
drawn, and stays silent where the font gives it no honest answer.
Across 118 843 arXiv PDFs not one byte of extracted text changes, and across
the 1 633 real forms four files gain text and none loses any.
pdffont v0.3.1 comes along, and where it applies ops v0.7.1.