fix(pdf): do not embed a CFF font of only .notdef - #925
Merged
Merged
Conversation
OTS rejects a `CFF ` table whose CharStrings INDEX holds fewer than two glyphs. The hidden OCR font of the Reicha scan is such a font, so the OTS check in CI failed. `cff::wrap_to_otf` now throws for it, and `font_is_usable` renders the text with a substitute. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKmQRa5uj4MfJxXfbA3crz
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKmQRa5uj4MfJxXfbA3crz
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.
🤖 Generated with Claude Code
Summary
The OTS check of
build-testfailed on main after #922 addedReichaCompositionslehreB2Teil4.pdfto the test data:The font is
HiddenHorzOCl, the hidden OCR text layer of the scan. Its CharStrings INDEX holds only.notdef. OTS rejects aCFFtable with fewer than two glyphs (charstring_index->count < 2inots/src/cff.cc), and it reports this as a Top DICT error.cff::wrap_to_otfnow throws for such a font, sofont_is_usablerenders the text with a substitute. The font draws no glyph, so no pixel changes.Reference output
This PR also regenerates the references for the stack #920 to #924, as those PRs said. #911 and #916/#917 did not regenerate theirs either, so the new references include those changes too.
resources/minimum-scale(#911), the pdf selection style (#916/#917), the frontend scripts (#912 to #918)resources/If I apply the known CSS changes to the old references, only the files that the stack and this PR explain still differ. No file is added or removed.
OpenDocument.test.output055e7ec,OpenDocument.test-private.output509b819, both onmain.Test
CffFontTest.WrapRejectsAFontOfOnlyNotdef.check_fonts.pyon the Reicha output: 0 rejected by OTS. The changed files compile with-Werror.