From 3bc45e97503172e45f57e347cd39058934a6f2ed Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 28 Aug 2026 11:33:04 +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 | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 8da06ca..9d69209 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.26.4 require ( github.com/go-gfx/gfx v0.10.0 - 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/ops v0.7.0 + github.com/go-pdfkit/ops v0.7.1 github.com/go-pdfkit/reader v0.6.0 github.com/go-pdfkit/render v0.11.0 github.com/go-widgets/painter v0.11.0 @@ -22,9 +22,9 @@ require ( github.com/go-iconoir/iconoir v0.2.0 // indirect github.com/go-images/images v0.0.0-20260811115337-bc5d586f8e38 // indirect github.com/go-opentype/fonts v0.9.0 // indirect - github.com/go-opentype/opentype v0.10.0 // indirect + github.com/go-opentype/opentype v0.12.0 // indirect github.com/go-opentype/shape v0.5.0 // indirect - github.com/go-pdfkit/pdffont v0.3.0 // indirect + github.com/go-pdfkit/pdffont v0.3.1 // indirect github.com/go-richdoc/richdoc v0.2.0 // indirect github.com/go-typeset/bidi v0.3.0 // indirect github.com/go-widgets/mvvm v0.5.0 // indirect diff --git a/go.sum b/go.sum index 8264f4d..0d785d5 100644 --- a/go.sum +++ b/go.sum @@ -20,18 +20,18 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 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.10.0 h1:cZVMZ3RVkcijXmxlmpqyVkjlNc33aSB2ugKVWYvoLUg= -github.com/go-opentype/opentype v0.10.0/go.mod h1:AOixevJf7XQaH7+WG+OMIOZEbYPXfMqklVk26Y6YTUU= +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-opentype/shape v0.5.0 h1:jHNaOMHNBdDj5EixOevlrrsi92svMxvVMKN7GYaPfxo= github.com/go-opentype/shape v0.5.0/go.mod h1:3ImRYNIj6zpwWQ/DV3BWhgMFfmzDITH6XpZw2auQHTo= -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-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/ops v0.7.0 h1:W8sK//0nfs/OACvjzvw/GK5ywtd90eDoYcdv74GxW8M= -github.com/go-pdfkit/ops v0.7.0/go.mod h1:Is3FBR2NcCUEzNt4eowdsVa+P0SBtGtcxK8lDlOeyrk= -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/ops v0.7.1 h1:JkjJOj4/x60VJpjGZgFTc950AE9hHUYBH9UlwJv3IzM= +github.com/go-pdfkit/ops v0.7.1/go.mod h1:rA+hZHtK3tpZW0j5Sz3sLBHMhbv3scPLI/k8Xij1r+U= +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= github.com/go-pdfkit/render v0.11.0 h1:z05asCKb8Bn/1JMU0r5KwqP5DiFkk0jJR3bVKGH4qj8=