From 18f50ff64cb7e9053d5d0f41e366762db5057b2e Mon Sep 17 00:00:00 2001 From: tannevaled Date: Thu, 27 Aug 2026 11:46:43 +0200 Subject: [PATCH] Read the letters those languages use, and stop three ways of going wrong pdffont v0.1.0 -> v0.3.0 and reader v0.4.0 -> v0.4.2. Four measured defects were being shipped by this package: - Glyph names covering Czech, Polish, Slovak, Hungarian, Turkish, Romanian, Latvian and Lithuanian letters mapped to nothing at all, so a word came back a letter short and still looked like a word. Names spelling more than one character were refused outright. - A /ToUnicode map of 10 655 bytes could name 13 million codes: 1 054 MB and about ten seconds, per font, per page. - A 219-byte file with no trailer and an object numbered 2 147 483 647 took 21.2 s to open while allocating nothing, so no memory limit stopped it. - InlineImage.Expanded walked the image dictionary in one pass, so a dictionary carrying both spellings of a key -- /W beside /Width -- had its winner picked by Go's randomised map iteration order. This package reads inline images, and Images therefore did not agree with itself from one run to the next. The first and the last of the four change what this package hands back, which is the whole of what it is for. --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index fe05a6a..472a3fa 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,8 @@ go 1.26.4 require ( github.com/go-opentype/opentype v0.9.0 - github.com/go-pdfkit/pdffont v0.1.0 - github.com/go-pdfkit/reader v0.4.0 + github.com/go-pdfkit/pdffont v0.3.0 + github.com/go-pdfkit/reader v0.4.2 ) require github.com/go-opentype/fonts v0.8.0 diff --git a/go.sum b/go.sum index 81877bb..ba08934 100644 --- a/go.sum +++ b/go.sum @@ -2,7 +2,7 @@ github.com/go-opentype/fonts v0.8.0 h1:77i3VPIH90GbstzNb21mk+an4WvEOe2idC6W+J0n0 github.com/go-opentype/fonts v0.8.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/pdffont v0.1.0 h1:mThWvPn3LLETup2adm9xMcNZWECP2Wq3eTSyTW4O3I0= -github.com/go-pdfkit/pdffont v0.1.0/go.mod h1:y4vo5DgT95e57C3XxIWfA/xss+x6RwZwyj6KWdJc86s= -github.com/go-pdfkit/reader v0.4.0 h1:qPbNZSO+Xl+4NBvQoV1PYt7HlqHaEAQ1tUc6/IL8JAU= -github.com/go-pdfkit/reader v0.4.0/go.mod h1:fQFOVfCMUui1AdvD4qhimdyvvNr9KvvJ1S7IuKZjyV8= +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/reader v0.4.2 h1:0/qPShLzdG/roH4i13dwDTHnS7mEBVTaCBGwCZQhOH0= +github.com/go-pdfkit/reader v0.4.2/go.mod h1:fQFOVfCMUui1AdvD4qhimdyvvNr9KvvJ1S7IuKZjyV8=