Skip to content

v0.49.0 — scrambled CAD text fixed, and four silent losses in markup

Choose a tag to compare

@KenM76 KenM76 released this 08 Sep 16:51
· 79 commits to main since this release

Scrambled text on CAD drawings, and four silent losses in markup

The headline: a whole class of drawing renders correctly now

Reported against a real 2013 SolidWorks drawing set: "Text on this sheet is
scrambled in pdfcer, but appears fine in acrobat reader."
Then, minutes
later, the observation that located it in one step: "when I go to edit the
text the text in the editor box shows correctly."

Reading the text was right; drawing it was wrong. 59 3/4" painted as
@ U / M@-shaped nonsense. The geometry was perfect throughout, which is why
it read as scrambled rather than broken. On page 1 alone, 961 glyphs
had no usable mapping.

For fonts flagged a certain way, the PDF standard says to pick glyphs by
their numeric code, straight out of the font's own table. pdfcer was
picking them by name instead. On a subsetted drawing font that does not
merely fail — the name route lands on a real, valid, unrelated glyph, so the
page paints confident garbage:

what the file said what should be drawn what pdfcer drew
three 3 U
four 4 V
six 6 @
one 1 M
nine 9 nothing

Acrobat was right and we were wrong, in a spot where the standard's printed
text and the way every real reader behaves have drifted apart. Unmapped
glyphs on that drawing went from 961 to zero
, across all 24 sheets.

⚠️ If you have a drawing that renders as garbage but whose text copies out
clean
, that was this bug. It is the signature.


Copy-paste gave you back a different mark than the one you copied

Copying a markup annotation and pasting it dropped four things you can
see:

what was lost what you saw
the border dash a dashed revision cloud came back solid
the opacity a 50 %-opacity highlight came back opaque
the note text a comment came back blank
the author and unsigned

Nothing reported it, and nothing could have: from the paste's point of view it
was drawing a fresh mark, and a fresh mark has no properties to report losing.

An annotation's blend mode was deleted on every restyle

Change a shape's colour and pdfcer deleted its blend mode. If you had set
Darken in Acrobat you got Normal back, were told nothing, and the page
composited differently from then on.

The standard as printed lists that key among the ones a reader may ignore.
The approved corrections removed it from that list — so the printed text
and the corrected text disagree about this exact key, and only the corrected
reading is the operative one.

A "contents locked" annotation could still have its comment overwritten

PDF has a flag whose entire job is "do not allow the contents of this
annotation to be modified."
pdfcer could read it, write it, and list it — and
no part of the program had ever checked it.

⚠️ Worse: the command-line help had been telling you it worked. It does now.

It stays carefully distinct from the other lock flag, which forbids almost
the opposite things — one stops deletion and moving while allowing the comment
to be edited; the other stops the comment while allowing deletion and moving.
Each refusal names the flag actually stopping you, because naming the other
one would send you to clear something that was never in your way.

A clipboard from the previous version would have been mis-read

Caught before this release rather than after. The copy-paste fix above
added a second piece of data per annotation without bumping the clipboard
format's version. A copy made by v0.48.0 and pasted into this build would
have had its second annotation swallowed into its first, and everything after
that mis-read — with no error, because the new field was deliberately built
never to fail.

Fixed with version gating, so an ordinary copy still declares the old version
and still pastes into a build you have open in another folder.


Housekeeping. One of pdfcer's own consistency checkers was found to be
blind to broken text in test assertions; widening it uncovered three real
broken messages, one shipped for weeks.

Verified: fmt, clippy -D warnings with CI's own flags, and all 21
document gates; ~6,980 tests across every package, zero failures, plus the
WebAssembly target, the fuzz harnesses, the no-default-features build and the
no-GUI-dependency invariant; CI green on the tagged commit; the portable
folder copied to a fresh path and the drawing re-rendered there.

sha256 of the zip is in the accompanying .sha256 file.