fix(render-pdf): draw text decoration marks and honour alpha on text, lines, and table paint#418
Merged
Merged
Conversation
… lines, and table paint
…nested draws after translucent runs
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.
Why
A cross-backend parity audit found the reference PDF backend silently losing two documented style capabilities the PPTX backend already delivers.
DocumentTextDecoration.UNDERLINE/STRIKETHROUGHresolved only to font faces that alias to the regular program, so decorated text rendered as plain glyphs. AndDocumentColor.rgba's alpha channel was honoured only on shape fills and strokes — text runs, lines, side borders, and table paint rendered fully opaque, so a translucent style produced different output per backend.What
PdfTextDecorationsdraws underline and strikethrough as em-proportional filled bands in the run's colour — underline 0.10 em below the baseline with 0.05 em thickness (the Type 1/Helvetica-AFM convention), strikethrough 0.28 em above. Marks are collected while the glyphs stream out (path fills are illegal insideBT/ET) and painted after the text, on paragraph runs, chips (only when the chip actually painted glyphs), and table cell text (measured with the same sanitized string the cell draws).PdfAlphaSupport: line fragments, per-side shape borders, and table cell fills, borders, and text use the translucent-onlyapplyFillAlpha/applyStrokeAlpha, while the paragraph run-state tracker routes its emissions through a sharedsetFillAlphahelper — it must also write an explicit opaque constant, because agssurvivesETand nested draws (chips, inline graphics, decoration marks) would otherwise inherit the translucent state. Each alpha change mints a freshExtGStateresource; deduplicating them per render pass is tracked in Dedupe ExtGState alpha resources per render pass #419.DocumentColor.rgba's Javadoc drops the opaque-surfaces caveat.Verification
PdfDecorationAndAlphaRenderTest(12 raster-comparison tests): the underline extends ink strictly below descender-free glyphs (catches a flipped offset), the strikethrough stays inside the glyph band (bounded above and below), translucent text, lines, table fills, table borders, table cell text, and side borders each render measurably lighter than their opaque twins, an underlined chip and an underlined table cell add mark ink, an opaque run's underline stays fully dark when a translucent run follows it on the same line, and an opaque inline shape after a translucent run stays fully dark — the two tests that pin the reset-before-nested-draw rule.clean verifyacross core, render-pdf, render-docx, render-pptx, templates, testing, root, bundle, qa, coverage — including the qa visual-regression suites, which confirm no shipped template's pixels moved.