Repository navigation
Conversation
|
✅ DCO Check Passed Thanks @wittjeff, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
|
@wittjeff it seems the regression tests are failing. Any idea why? |
|
Yes — my fault, and the CI diff pinpointed it. The widening was on the wrong axis; fixed and re-pushed. What broke. The 29 failing pages all follow one pattern: real ASCII text turned into markers ( The case #322 is actually about is narrower. @yalsaffar's logs show both warnings together: i.e. a symbolic font with neither a usable cmap nor any declared The fix (one condition, pushed as a follow-up commit): const bool has_declared_simple_encoding =
(has_explicit_encoding and encoding != CMAP_RESOURCES) or diff_initialized;
if(subtype==TYPE_0 or
(is_symbolic and (cmap_initialized or not has_declared_simple_encoding)))Case table:
I also fixed the synthetic test to match the reported shape: the no-cmap symbolic test now also omits Verified locally against the full regression suite: One residual gap, deliberately not touched here: a symbolic no-encoding font whose name matches a core-14 alias (e.g. an |
|
@wittjeff can you resolve the mergre conflicts, I think this should be an easy one to merge then |
Follow-up to docling-project#299. The guard added there only fired when a cmap parsed (cmap_initialized == true) and merely missed the code. A symbolic or Type0/CID font whose /ToUnicode fails to parse ("could not find cmap in '/ToUnicode'"), or that carries none, sets cmap_initialized = false, skips the guard, and falls through to the Standard/WinAnsi tables — which fabricate unrelated text again (e.g. '!"#'). Drop the cmap_initialized requirement for symbolic/composite fonts: their codes bear no relation to the standard encodings, so an unresolved code must surface as a GLYPH marker regardless of whether a cmap was parsed. Non-symbolic fonts are unaffected (they legitimately use the declared encoding). Adds a test for a symbolic font with no /ToUnicode (marker) plus a non-symbolic control (encoding preserved). Reported by @yalsaffar in docling-project#299. Signed-off-by: Jeff Witt <152964771+witt3rd@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ble cmap The previous commit widened the glyph-marker guard to every symbolic font whose cmap did not resolve a code, which broke 29 regression pages across 7 documents (font_01.pdf, deep-mediabox-inheritance.pdf, five dln_* docs): their fonts carry a spurious symbolic flag but explicitly declare /WinAnsiEncoding or an /Encoding dict with /Differences, and codes outside /Differences legitimately resolve through the declared base encoding (PDF 32000-1 9.6.6). Only emit the marker for a simple symbolic font when neither a parsed cmap (docling-project#299 case) nor any declared simple encoding exists — the shape in the original report, whose logs show both 'could not find cmap in /ToUnicode' and 'font-encoding not defined'. Type0/CID stays unconditional. The synthetic no-cmap test now models that shape faithfully: no /Encoding entry and a subset-style BaseFont name so the core-14 alias table stays out of the way. A new control asserts a symbolic-flagged font with declared WinAnsi keeps its text — the exact shape that failed CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Jeff Witt <1848307+wittjeff@users.noreply.github.com>
3e41494 to
d3d3dcf
Compare
|
Rebased onto Verified locally on the rebased branch: the 7 tests in |
|
@wittjeff I think we are seeing here some interesting regression tests |
A symbolic simple font with no /Encoding maps its codes through the embedded program's builtin encoding (PDF 32000-1 9.6.6.2, 9.6.6.4). The parser never consulted it for text: with no usable /ToUnicode the codes fell through to the Standard table, which fabricates (Ł for Cyrillic и, '&' for a glyph index) and only coincides with the font for ASCII. Open the program with FreeType, walk codes 0-255 through the builtin charmaps (Adobe custom/standard/Latin-1, MS symbol at 0xF000, then any remaining table) and take the text from the glyph's PostScript name (AGL, uniXXXX, uXXXX) or the program's Unicode cmap; a blank glyph reads as a space, a glyph with neither stays a GLYPH marker. Precedence is /Differences, /ToUnicode, builtin, then the existing name-matched tables and the docling-project#299/docling-project#322 marker guard. Mirrors the renderer's char_code_to_glyph_index so text and drawn glyph agree. Regression corpus @ 571f34b: 16 pages in 4 documents change, all of this font shape; the output matches PyMuPDF on those pages. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B6oAsX79utapMVcbRKU6vh Signed-off-by: Jeff Witt <1848307+wittjeff@users.noreply.github.com>
|
Interesting indeed — and they point at a real gap, so I fixed that rather than the guard. What the 60 failing pages are. Four documents, all new to the corpus since the August run. Every affected font has the same shape: symbolic flag set, program embedded, no
So the guard alone is half right: it stops the fabrication ( The right answer is the builtin encoding. A symbolic simple font without a declared base encoding maps its codes through the embedded program itself (PDF 32000-1 9.6.6.2 for Type 1/CFF, 9.6.6.4 for the TrueType (3,0) cmap). The renderer already does exactly this for glyph identity ( Regression suite, run locally on the full corpus @
Everything else in the corpus is unchanged — including the seven documents that broke in August and the TeX/arXiv documents — so wherever the builtin path and the existing tables both apply they agree. Tests. Groundtruth. The stored groundtruth for these four documents was never right (it encodes the Standard-table fallback), so the 16 pages above need regenerating in the dataset repo once this lands. Happy to open that PR against One residual, unchanged from before: when the builtin lookup finds no text for a glyph and the font's name matches a core-14 alias, the name-matched AFM table is still consulted ( |
|
Dataset groundtruth PR for the 16 pages above, regenerated on a641751 and verified by hash to touch nothing else: https://huggingface.co/datasets/docling-project/regression-dataset-for-docling-parse/discussions/4 |
|
Thanks for this contribution. This PR is on hold until it has been consolidated as described in #428. Please resubmit it as part of the topic PR listed there, with the evidence the issue asks for. |
Follow-up to #299 (thanks @yalsaffar for the report).
The guard added in #299 only fired when a
/ToUnicodecmap parsed (cmap_initialized == true) and merely missed the code. A symbolic or Type0/CID font whose/ToUnicodefails to parse (could not find cmap in '/ToUnicode'), or that carries none, setscmap_initialized = false, skips the guard, and falls through to the Standard/WinAnsi tables — which fabricate unrelated text again (e.g.!"#).This drops the
cmap_initializedrequirement for symbolic/composite fonts: their codes bear no relation to the standard encodings, so an unresolved code must surface as aGLYPH<>marker regardless of whether a cmap was parsed. Non-symbolic fonts are unaffected (they legitimately use the declared encoding).Adds two tests: a symbolic font with no usable
/ToUnicode(must emit markers, not fabricate) and a non-symbolic control (encoding preserved). Reproduced against the current build; the change is a one-line guard widening.