Repository navigation
fix(pdf-codec, documents.js): decimal points, Distiller glyph ids and tables open at a page break - #1810
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three PDF reading defects, each found on a real document and fixed at its cause.
A verified symbol subset whose font dictionary names no encoding (pdf-codec). A typesetter's math italic subset draws a full stop at the glyph it names
/colonand a comma at/semicolon, and its/ToUnicodereads each by its name, so0.212reads as0:212. The checked tables inverified-glyph-tables.tsselect a glyph by the name/Differencesor the named base encoding gives its code; a dictionary with no/Encodingat all reaches the glyph through the program's built-in encoding, which the lookup never asked. It now does (ISO 32000-1 9.6.6.1), opening the program only for a font whose subset has a table, and the secondAdvP4C4E51program written this way is added with its rendered sheet.A Century Schoolbook subset Distiller numbers
g<id>(pdf-codec). Distiller converts the TrueType face to a CFF subset naming each glyphgplus its glyph id in the face, the lower-case form of the optimiser'sG<id>. With no/ToUnicodeevery code read as U+FFFD. The numbered-name pattern takes either case and the generated glyph orders carry the four Century Schoolbook faces; regenerating left the twelve faces already carried byte-identical, and the width agreement check still decides whether a subset is the face.A ruled table whose row is left open at a page break (documents.js). A table breaking across pages leaves its last row open at the foot of the page, the rule under it drawn under some columns or none and the side borders running down to it. Since a border drawn in pieces is joined into one boundary, that open row became the grid's bottom edge, the rectangle did not close, and the whole table was read as prose with tab-separated rows. A grid that does not close now loses a top or bottom row boundary that does not span it and is tested again; no column boundary is ever taken off, so a gap in a side border still leaves the grid unclosed.
Measured on the real documents, re-extracted with these builds:
Tests use made-up fixtures of the same shapes: a synthetic CFF program with a built-in encoding and no dictionary
/Encoding, a made-up line in Century Schoolbook Bold's glyph ids and widths (refused under the italic face's name), and a grid with an open last row, an open first row, a gap in a side border and a short side border. Each new assertion fails onmain.