fix(writer): emit fill colour for embedded-font text - #911
Conversation
PdfWriter::add_element routed embedded-font text through the colour-agnostic add_embedded_text without ever emitting the element's fill colour, so inline_color (and any coloured text) on an embedded font rendered black — no rg operator reached the content stream. The base-14 path (add_text_content) always emits rg from style.color; the embedded path now matches it by emitting fill_color before the glyph run. Adds a regression test asserting the rg operator is present for embedded-font inline_color. Signed-off-by: Norbert Preining <norbert@arxiv.org>
|
Reviewed + regression-tested — this looks good, thank you @norbusan. Nicely diagnosed: embedded-font text routed through the colour-agnostic Correctness — confirmed:
Verification I ran:
Two optional nits (non-blocking):
One heads-up for future PRs (we're formalizing this in #901): please open an accepted issue first and include a self-run verification. Not blocking this one — it's small, well-tested, and I've verified it. Marking this ready to merge. |
|
Follow-up: I reproduced the defect against So on |
|
Thanks for your comments. Yes, I hit the problem in our watermarking text which suddenly turned up black instead of light gray after switching to pdf_oxide. I will try to remember opening an issue with reproducible code next. There is one more in my pipeline (text extraction). Thanks |
|
Is there anything else I need to do at the current state? Thanks |
|
Thanks — and that's a perfect real-world confirmation (arXiv watermark text going black instead of light-gray is exactly the defect). Good to know it lets you drop the manual-PDF-command workaround on your side. Nothing more needed from you right now. This PR is approved and in our merge queue; it'll merge automatically once it reaches the front and passes the full CI matrix (we run these one-at-a-time, so it may take a little while). We'll handle the merge. On the OCR test failures you saw — that's local dependency drift, not a repo issue: our CI pins the OCR package versions and the OCR job is green on On the next one (text extraction) — thank you for adopting issue-first. One heads-up: a text-extraction change is a heavier bar than this writer fix, because extraction runs through shared heuristic paths where a change can silently perturb other documents. Per
Happy to help if anything there is unclear. Thanks again for the clean fix. |
yfedoseev
left a comment
There was a problem hiding this comment.
Approved — reviewed and regression-passed; in the merge queue. (Formal approval to supersede the earlier review state and record sign-off.)
|
(funny, passing through Vancouver on my way home from Calgary in a few hours, beautiful area ❤️ ) |
Description
PdfWriter::add_element routed embedded-font text through the colour-agnostic add_embedded_text without ever emitting the element's fill colour, so inline_color (and any coloured text) on an embedded font rendered black — no rg operator reached the content stream. The base-14 path (add_text_content) always emits rg from style.color; the embedded path now matches it by emitting fill_color before the glyph run.
Adds a regression test asserting the rg operator is present for embedded-font inline_color.
Type of Change
Related Issues
Fixes #
Changes Made
Testing
cargo test(see CONTRIBUTING.md —--all-featuresfails to build:fipsandlegacy-cryptoare mutually exclusive by design)cargo clippy -- -D warningscargo fmtPython Bindings (if applicable)
ruff formatruff checkDocumentation
Checklist
feat:,fix:,docs:)