From 7859e5a98f2723ee5f7287d30176cee17b57ce1d Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 28 Aug 2026 11:33:00 +0200 Subject: [PATCH] deps: read a symbolic TrueType font, so a scanned-era form says something MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 8dc9220..43c1663 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,13 @@ module github.com/go-pdfkit/ops go 1.26.4 require ( - github.com/go-pdfkit/extract v0.2.0 + github.com/go-pdfkit/extract v0.3.0 github.com/go-pdfkit/forms v0.2.2 github.com/go-pdfkit/reader v0.6.0 ) require ( github.com/go-opentype/fonts v0.9.0 // indirect - github.com/go-opentype/opentype v0.9.0 // indirect - github.com/go-pdfkit/pdffont v0.3.0 // indirect + github.com/go-opentype/opentype v0.12.0 // indirect + github.com/go-pdfkit/pdffont v0.3.1 // indirect ) diff --git a/go.sum b/go.sum index d3a169a..dfe64cd 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,12 @@ github.com/go-opentype/fonts v0.9.0 h1:slB6OB3riLyUPrOxqXe0s6/AzdenF1TDvCN8N87hhQk= github.com/go-opentype/fonts v0.9.0/go.mod h1:C6yQL2apHItfEZ5hztpsHF0S5mlX/hklLlq/Z5fRG/g= -github.com/go-opentype/opentype v0.9.0 h1:GFgcJ3nwTDp4NJr5O+Paw7lhZx5Jv/R+noZwvhYDlkM= -github.com/go-opentype/opentype v0.9.0/go.mod h1:AOixevJf7XQaH7+WG+OMIOZEbYPXfMqklVk26Y6YTUU= -github.com/go-pdfkit/extract v0.2.0 h1:ibx2C2mJTJjGzP9bRnrRnmvdeZjv9aTas6tSkeEiTeM= -github.com/go-pdfkit/extract v0.2.0/go.mod h1:7KJGmgvxjk9qqbDdjpaAcEzd4G3vq3ciHuuufVdLiu4= +github.com/go-opentype/opentype v0.12.0 h1:wBlcDi+3ZaNZXEt5z+Ixr11/cYYwi5W+jX6yTl/qr1I= +github.com/go-opentype/opentype v0.12.0/go.mod h1:AOixevJf7XQaH7+WG+OMIOZEbYPXfMqklVk26Y6YTUU= +github.com/go-pdfkit/extract v0.3.0 h1:w1ansrvMNqd+Hy1p5fo1orh6hM8meb+xCNKNap/7omM= +github.com/go-pdfkit/extract v0.3.0/go.mod h1:EOWOcx3o0HDC3ryCMoE9pwNIb3mwVmnXBSpTRfO1VdY= github.com/go-pdfkit/forms v0.2.2 h1:tGnENs09LBUBppSrH0dGenV8KCQcbngsi+OatWID90Y= github.com/go-pdfkit/forms v0.2.2/go.mod h1:dQ4FzO6qF7RJh6oEa0dkgL0i8hKBmm/e7hj4XC56h5Q= -github.com/go-pdfkit/pdffont v0.3.0 h1:G5DKcAmsZJ0e17QhSrcUaL7PKEXKjUx4P/iGMl7bAbI= -github.com/go-pdfkit/pdffont v0.3.0/go.mod h1:bfmNLna1l1CljNX/Utg55YzFylovfmI7sJnvgA3bzKI= +github.com/go-pdfkit/pdffont v0.3.1 h1:+K7opHGRERDZ5EMkA12s1GT48t8GpncArhnyzyc5bxU= +github.com/go-pdfkit/pdffont v0.3.1/go.mod h1:eFJ/7t9AvcX76KY5qNJMMKetz8hUUUdVM1qSWLi3S1g= github.com/go-pdfkit/reader v0.6.0 h1:KAabNOYUcTlZlNBTbG9bEhWP1NiZhjuhzUdavdTdfes= github.com/go-pdfkit/reader v0.6.0/go.mod h1:fQFOVfCMUui1AdvD4qhimdyvvNr9KvvJ1S7IuKZjyV8=