Commit cceb54c
committed
fix(pdf): drop overprinted duplicate glyphs (kashida) — right_to_left_02 8→6
The scanned-garbled Arabic in right_to_left_02 re-stamps a waw elongation
segment offset by far less than its width (an overprint for visual weight), so
the parser emitted ~25 extra `و` (`قويووووة` vs docling's `قويوووة`). The line
sanitizer's ligature-recompose was appending the duplicate because its box
overlaps the previous glyph within tolerance.
`line_cells` now drops a same-character glyph re-stamped at an *offset*
overlapping box (offset > 0.1). The offset guard preserves ligature expansion,
which decomposes one glyph into several chars at the *identical* box (`ff`→`ff`,
offset ≈ 0) — verified 2305.03393v1-pg9 stays byte-exact. The whole garbled
paragraph now matches docling; the conformance exact count is unchanged at 5/14
(the remaining right_to_left_02 diff is the page-number `11` layout/reading
order). Parser-path only (`euclidean`).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYCj8stK1TzKcy6crtTfha1 parent e70cdfd commit cceb54c
3 files changed
Lines changed: 31 additions & 10 deletions
File tree
- crates/fleischwolf-pdf/src
- tests/snapshots/pdf/sources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
120 | 130 | | |
121 | 131 | | |
122 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
231 | 242 | | |
232 | 243 | | |
233 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
0 commit comments