Skip to content

A form that converted to three hundred bytes now converts to eight thousand - #6

Merged
tannevaled merged 1 commit into
mainfrom
deps/symbolic-truetype
Aug 28, 2026
Merged

A form that converted to three hundred bytes now converts to eight thousand#6
tannevaled merged 1 commit into
mainfrom
deps/symbolic-truetype

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

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 a document set in one converted to
a heading and nothing else.

Four US Department of Labor forms from 1999, converted to LaTeX:

1999-schedule-i 296 bytes, 16 words -> 8 565 bytes, 1 955 words
1999-5500-schedule-a 354 bytes, 32 words -> 10 550 bytes, 2 605 words
1999-schedule-d 325 bytes, 24 words -> 4 972 bytes, 540 words
1999-schedule-g 354 bytes, 32 words -> 6 466 bytes, 825 words

Reading the page rather than the file: schedule I gave "2 0 9 9 0 0 0 1 1 M"
and now gives "SCHEDULE I Financial Information -- Small Plan Official Use
Only / (Form 5500) OMB No. 1210-0110 ...", which is 1 103 words against
pdftotext's 1 105 on the same page.

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 actually gets drawn, and stays silent where the font gives it no
honest answer.

…ght thousand

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 a document set in one converted to
a heading and nothing else.

Four US Department of Labor forms from 1999, converted to LaTeX:

  1999-schedule-i        296 bytes,  16 words  ->  8 565 bytes, 1 955 words
  1999-5500-schedule-a   354 bytes,  32 words  -> 10 550 bytes, 2 605 words
  1999-schedule-d        325 bytes,  24 words  ->  4 972 bytes,   540 words
  1999-schedule-g        354 bytes,  32 words  ->  6 466 bytes,   825 words

Reading the page rather than the file: schedule I gave "2 0 9 9 0 0 0 1 1 M"
and now gives "SCHEDULE I Financial Information -- Small Plan Official Use
Only / (Form 5500) OMB No. 1210-0110 ...", which is 1 103 words against
pdftotext's 1 105 on the same page.

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 actually gets drawn, and stays silent where the font gives it no
honest answer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit eb3924b into main Aug 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant