Content missing when printing PDFs
Categories
(Core :: Graphics, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox150 | --- | unaffected |
| firefox151 | --- | unaffected |
| firefox152 | + | fixed |
People
(Reporter: RyanVM, Assigned: jfkthame)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files, 1 obsolete file)
Bisected with mozregression to the Cairo update, naturally.
Attempting to print a PDF of sheet music, the lyrics and notes are completely missing, reproducible on paper and printed to PDF. Some kind of layering issue? I've attached a PDF of what the printed output looks like and will find a way to share the original copywritten PDF with whomever wants to investigate.
| Reporter | ||
Comment 2•17 days ago
|
||
I should note that this was happening on Windows 11 in my case.
| Reporter | ||
Comment 3•17 days ago
|
||
The printed PDF is also almost 4MB when the original file was only a bit over 200kB.
| Reporter | ||
Comment 4•16 days ago
|
||
There's been a few upstream fixes landed in the win32 printing code since 1.18.4 was released, but a build with all them cherry-picked still reproduces the problem. A build with _cairo_dwrite_scaled_font_init_glyph_surface reverted back to it's previous state does fix the problem, however.
https://treeherder.mozilla.org/jobs?repo=try&revision=7beacf87e5f17392691bfca3dd299a07bc8c36d8
Comment 5•15 days ago
|
||
The bug is marked as tracked for firefox152 (nightly). However, the bug still isn't assigned.
:bhood, could you please find an assignee for this tracked bug? Given that it is a regression and we know the cause, we could also simply backout the regressor. If you disagree with the tracking decision, please talk with the release managers.
For more information, please visit BugBot documentation.
Comment 6•15 days ago
|
||
Does skpdf fix this? (printing.experimental.skpdf=true)
| Reporter | ||
Comment 7•15 days ago
|
||
Still reproducible after setting that pref (doesn't exist by default in about:config) and restarting the browser.
Comment 8•15 days ago
|
||
Sorry, print.experimental.skpdf, ugh!
| Reporter | ||
Comment 9•15 days ago
|
||
Still reproducible after flipping that pref in about:config and restarting.
Updated•15 days ago
|
Updated•15 days ago
|
| Reporter | ||
Comment 10•15 days ago
|
||
For clarity, I'm using the "Microsoft Print to PDF" printer rather than the "Save to PDF" option from the print dialog. The former matches what I see printed on my actual printer.
Comment 11•15 days ago
|
||
Ah yeah so this depends on rewriting PrintTargetWindows to use SkPdf.
Comment 12•15 days ago
|
||
| Reporter | ||
Comment 13•15 days ago
|
||
The 1.18.4 rewrite of this function (using IDWriteGlyphRunAnalysis directly)
has multiple bugs that surface during PDF print rasterization fallback,
producing pages with all glyphs missing. Revert to the pre-1.18.4 GDI-based
implementation, which uses _dwrite_draw_glyphs_to_gdi_surface_gdi and
_cairo_compute_glyph_mask. Use the variations-aware scaled_font->dwriteface
field added in 1.18.4 so variable-font axis values are still honoured.
| Reporter | ||
Comment 14•15 days ago
|
||
I'm not saying this is the patch we should take, but I'm attaching it for posterity at least. As mentioned in comment 4, this does fix the regression albeit at the cost of being yet another relatively heavy revert in our Cairo patch stack.
| Assignee | ||
Comment 15•14 days ago
|
||
Interestingly, AFAICS it seems that _cairo_dwrite_scaled_font_init_glyph_surface is rasterizing the glyphs as expected; inspecting surface_data at the end of that function, I'm seeing the expected bitmaps. It's not clear to me why they're failing to appear in the output.
| Assignee | ||
Comment 16•14 days ago
|
||
| Assignee | ||
Comment 17•14 days ago
|
||
Ryan, the above patch seems to resolve the missing text in my testing, with your PDF as well as some other examples. I'll do a bit more testing tomorrow, but you might also like to give it a whirl.
This doesn't address the fact that we end up with the page rendered as a rasterized bitmap, so the text is not searchable/selectable; that's a separate issue (and I assume was also the case prior to the cairo update). Not all documents exhibit that issue; it depends on the particular graphics features used during the rendering.
| Reporter | ||
Comment 18•14 days ago
|
||
Yeah, I can confirm that older Firefox versions also end up with a rasterized bitmap when printing that particular PDF.
| Reporter | ||
Comment 19•13 days ago
|
||
Jonathan's patch also works on my machine.
Updated•13 days ago
|
| Reporter | ||
Comment 20•11 days ago
|
||
Is it possible to create a test for this?
| Assignee | ||
Comment 21•11 days ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #20)
Is it possible to create a test for this?
Our "printing" tests normally use the Save as PDF backend, rather than an actual Windows printer driver, so they don't exercise the same code path. So I'm not sure how readily we can test this in CI, but I was intending to try and look into it.
(I'm going to go ahead and land the patch, even though we don't currently have test coverage for it, so that at least it's in Nightly for manual verification.)
Comment 22•11 days ago
|
||
Comment 23•11 days ago
|
||
| bugherder | ||
Updated•1 day ago
|
Description
•