Closed Bug 1723787 Opened 3 years ago Closed 3 years ago

Emoji not showing after printing to PDF

Categories

(Core :: Printing: Output, defect)

Firefox 90
Unspecified
macOS
defect

Tracking

()

VERIFIED FIXED
93 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- fixed
firefox90 --- wontfix
firefox91 --- wontfix
firefox92 --- verified
firefox93 --- verified

People

(Reporter: jamesgillard, Assigned: jfkthame)

References

(Regressed 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(5 files)

Attached file emoji-print-issue.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36

Steps to reproduce:

I can reproduce by following these steps:

  1. Open the attached HTML file.
  2. Save to PDF.
  3. View the PDF in a PDF viewer.

I'm on MacOs Big Sur 11.5.1.

Tested working in 89.0.2.
Tested not working in 90.0.2 latest stable.
Tested not working in 91.0b9 beta.
Tested not working in 92.0a1 nightly.

Actual results:

The emoji is visible on the print preview screen.

The emoji is not visible when I view the saved PDF.

When I drag the cursor over where the emoji should be, it gets selected/outlined, and then right clicking on the selected area shows the emoji is in fact there, but I can't see it. Here's a screenshot of what this looks like to me. Firefox on the left, PDF on the right:
https://i.ibb.co/ZLLZ1Fh/Screenshot-2021-08-03-at-17-40-13.png

Expected results:

The emoji is visible on the print preview screen.

The emoji is visible when I view the saved PDF.

Here's the screenshot showing Firefox on the left showing the HTML file, and MacOS Preview on the right showing the printed PDF, with the invisible but present emoji character.

The Bugbug bot thinks this bug should belong to the 'Core::Printing: Output' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Printing: Output
Product: Firefox → Core

Here's an example printed PDF that has the issue.

Thanks for reporting! jamesgillard, would you mind narrowing down which bug caused this issue by using https://mozilla.github.io/mozregression/?

Note that I can't reproduce the issue on my Linux box.

Flags: needinfo?(jamesgillard)
OS: Unspecified → macOS
QA Whiteboard: [qa-regression-triage]

From mozregression:

2021-08-04T09:44:30.250000: DEBUG : Found commit message:
Bug 739096 - Don't leave the shm field uninitialized in cairo_xlib_display. r=jrmuizel

This resulted in a valgrind failure on autoland.

Submitted upstream at https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/170.

Differential Revision: https://phabricator.services.mozilla.com/D113756

2021-08-04T09:44:30.250000: DEBUG : Did not find a branch, checking all integration branches
2021-08-04T09:44:30.262000: INFO : The bisection is done.
Flags: needinfo?(jamesgillard)

Great, thanks!

Severity: -- → S3
Regressed by: 739096
Has Regression Range: --- → yes

Interesting - the generated PDF supposedly includes (a one-character subset of) the Apple Color Emoji font, so it's trying to do the right thing, but I guess it's failing to include the actual color-bitmap table or something like that.

Looking more carefully at the behavior in Firefox 89, it wasn't actually correct there either: the emoji glyph is rendered somewhat too large in the PDF. This is more obvious if you modify the testcase to have multiple emojis, as the error accumulates. So saving something like

x💛💛💛💛💛💛💛💛💛💛x

shows a clear visual error when viewing the resulting PDF.

It looks like it's actually painting the glyphs as images in the PDF, overlaid with text content that renders blank (because the embedded "Apple Color Emoji" font just contains a blank glyph) but makes it possible to search/copy/etc the text.

Set release status flags based on info from the regressing bug 739096

So this is basically https://gitlab.freedesktop.org/cairo/cairo/-/issues/54.

We added support for this in bug 715798, but although some Core Text APIs have been adopted upstream, not all of this work has been merged there and so the cairo update regressed it.

I was going to re-do this manually, but then found that Andrea Canciani has a branch at https://gitlab.freedesktop.org/ranma42/cairo/-/commits/quartz-colored-glyphs that has the necessary patches, and these apply successfully to the code we have in the tree. So to minimize the risk of overlooking something, I'm pulling those commits instead of recreating the changes by hand.

I believe the resulting behavior still suffers from rendering Apple Color Emoji glyphs slightly oversized, but that's the same as was happening before the cairo update. (It looks a lot like what we were seeing in bug 804934, although a macOS update appeared to resolve that.) Anyhow, I don't think that should block taking the fix here, which at least restores the pre-bug 739096 rendering.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

Given the scale of the patch here, I'm inclined to hold this until after the Fx92 soft-freeze, and then request beta uplift once it is safely on Nightly93.

Needinfo-ing myself as a reminder to land this next week.

Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1e2706a53da8
Apply cairo quartz font/surface changes from Andrea Canciani's quartz-colored-glyphs branch at https://gitlab.freedesktop.org/ranma42/cairo/-/commits/quartz-colored-glyphs. r=jrmuizel
https://hg.mozilla.org/integration/autoland/rev/bbdde1587188
Add print reftest to verify that emoji are not blank when printing. r=jrmuizel
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/29944 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
Upstream PR merged by moz-wptsync-bot

Comment on attachment 9234960 [details]
Bug 1723787 - Apply cairo quartz font/surface changes from Andrea Canciani's quartz-colored-glyphs branch at https://gitlab.freedesktop.org/ranma42/cairo/-/commits/quartz-colored-glyphs. r?jrmuizel

Beta/Release Uplift Approval Request

  • User impact if declined: Emoji fail to appear in PDF output on macOS
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Merging changes from an upstream branch that has been around quite a while (and is based on what we used to have in Gecko's old forked cairo), so it's pretty well tested/reviewed code.
  • String changes made/needed:
Flags: needinfo?(jfkthame)
Attachment #9234960 - Flags: approval-mozilla-beta?
Attachment #9235028 - Flags: approval-mozilla-beta?

Comment on attachment 9234960 [details]
Bug 1723787 - Apply cairo quartz font/surface changes from Andrea Canciani's quartz-colored-glyphs branch at https://gitlab.freedesktop.org/ranma42/cairo/-/commits/quartz-colored-glyphs. r?jrmuizel

Approved for 92.0b5. Thanks for including a test.

Attachment #9234960 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9235028 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify+
QA Whiteboard: [qa-regression-triage] → [qa-regression-triage] [qa-triaged]

Managed to reproduce the issue on Nightly 2021-08-03 using macOS 10.15.
Retested everything on Nightly 93.0a1 and Firefox 92.0b6 using macOS 10.15, Windows 10 x64 and Ubuntu 16.04 x64. The issue is not reproducing anymore.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

Please nominate this for ESR91 approval also when you get a chance.

Flags: needinfo?(jfkthame)

Comment on attachment 9234960 [details]
Bug 1723787 - Apply cairo quartz font/surface changes from Andrea Canciani's quartz-colored-glyphs branch at https://gitlab.freedesktop.org/ranma42/cairo/-/commits/quartz-colored-glyphs. r?jrmuizel

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Regression with significant user impact, low-risk fix
  • User impact if declined: Emoji fail to appear in print/PDF output on macOS
  • Fix Landed on Version: 92
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Merging changes from an upstream branch that has been around quite a while (and is based on what we used to have in Gecko's old forked cairo), so it's pretty well tested/reviewed code.

Fix verified on Nightly and Beta already.

  • String or UUID changes made by this patch:
Flags: needinfo?(jfkthame)
Attachment #9234960 - Flags: approval-mozilla-esr91?
Attachment #9235028 - Flags: approval-mozilla-esr91?

Comment on attachment 9234960 [details]
Bug 1723787 - Apply cairo quartz font/surface changes from Andrea Canciani's quartz-colored-glyphs branch at https://gitlab.freedesktop.org/ranma42/cairo/-/commits/quartz-colored-glyphs. r?jrmuizel

Approved for 91.1esr.

Attachment #9234960 - Flags: approval-mozilla-esr91? → approval-mozilla-esr91+
Attachment #9235028 - Flags: approval-mozilla-esr91? → approval-mozilla-esr91+
Regressions: 1803909
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: