Repository navigation
Conversation
The layout heuristics need the font size and the advance width of a character, so compute a box from these and place it with the text matrix instead of relying on the loose box of pdfium. This also works for rotated text, which removes the need to fix up their boxes. Lines of the same font size are now merged into the longer line, since comparing the line heights for equality depended on rounding errors.
Lines of the same font size, whose characters are printed on top of each other, are not sub- or superscript but separate lines, like the numerator and denominator of a formula or overlapping index entries.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Follow-up to #22: instead of emulating the loose character box of the old pdfium (float32 rounding and all, meh), this computes our own box from what the layout heuristics actually want: the font size and the advance width, placed by the full text matrix.
Character._em_box()is one font size tall and one advance width wide, which also works for rotated text, soPage._fix_bboxes()and its cache are gone.FIXMEabout formulas colliding vertically.What changes in the output:
<sub>The remaining 208 are real subscripts like
V<sub>BAT</sub>. Fractions now come out as numerator / dashes / denominator on separate lines instead of a<sub>/<sup>salad.Missing:
mm²in a table cell is still wrong, just differently.Armdoublebut breaksCortex®-M7intoCortex -M7since the®is filtered out, so only the bullet points get their space back for now.