Open Bug 860142 Opened 11 years ago Updated 2 years ago

emoji doesn't honor color: transparent on Mac OS X

Categories

(Firefox :: PDF Viewer, defect, P3)

x86
macOS
defect

Tracking

()

People

(Reporter: jtd, Unassigned)

References

()

Details

(Whiteboard: [pdfjs-rendering])

Attachments

(2 files)

The Unicode code page pdf for emoji doesn't display correctly, under OSX it displays a bunch of color emoji characters, I'm guessing fallback is occuring.  Both OSX Preview.app and Safari/Chrome display the pdf correctly, without the use of color emoji.

Note: I tested with the latest dev version of pdf.js from github.
Priority: -- → P3
Whiteboard: [pdfjs-c-rendering]
Yes, with textLayer=off it looks OK (without checking in detail).

It seems like the embedded font must be loading successfully, otherwise it wouldn't be able to draw the glyphs on the canvas; but then why does it fall back to Apple Color Emoji in the text layer? Strange...
The textlayer should be invisible no matter what. It seems on windows things work as expected, but on OSX the emoji text is visible.

I say we should re-file this issue since it seems it's not really an issue with pdf.js.
Component: PDF Viewer → Graphics: Text
Product: Firefox → Core
Summary: emoji codepage sample doesn't not display correctly in pdf.js → emoji doesn't honor color: transparent on Mac OS X
Obviously emoji will not honor other color values. Should "transparent" be special?
(In reply to Brendan Dahl from comment #3)
> The textlayer should be invisible no matter what. It seems on windows things
> work as expected, but on OSX the emoji text is visible.
> 
> I say we should re-file this issue since it seems it's not really an issue
> with pdf.js.

I don't think I see what the issue here would be in Graphics:Text, differences in textlayer rendering are a pdf.js issue, no?  Differences in Windows vs. OSX I think are most likely related to font availability.  I think the comparison is what pdf.js produces vs. what Preview.app or Safari displays - both of those do not show the color emoji.
(In reply to John Daggett (:jtd) from comment #5)
> I don't think I see what the issue here would be in Graphics:Text,
> differences in textlayer rendering are a pdf.js issue, no?  Differences in
> Windows vs. OSX I think are most likely related to font availability.

Even if emoji font is present on Windows (for example on Windows 8), it will honor "color: transparent" because Windows doesn't support multiple color glyph.

> I think the comparison is what pdf.js produces vs. what Preview.app or Safari
> displays - both of those do not show the color emoji.

pdf.js tries to produce what Preview.app does, but it is prevented by the renderer's bug (or feature).
Attached file Minimized testcase
This patch doesn't have to do with PDF at all.
What is the expected result?
If emoji glyphs should be transparent, this is a Core/Graphics bug. If emoji glyphs should ignore "transparent" just like all other colors, we need to find other workarounds and I'll change back the component to Firefox/PDF.js.
> This patch
Of course, this testcase.
Some other questions:
1. What about rgba() and hsla() colors?
2. How Safari behaves?
The testcase shows that Safari also ignores the color property on the Apple Color Emoji text. I think that's pretty reasonable, actually.

That presumably means that pdf.js would have the same problem displaying the emoji code chart in Safari, too (untested).

Maybe pdf.js could use opacity:0 to make the text layer invisible, instead of setting the color?
(In reply to Jonathan Kew (:jfkthame) from comment #10)
> Maybe pdf.js could use opacity:0 to make the text layer invisible, instead
> of setting the color?

Unfortunately it made the selection invisible :(
Changing back the component because it looks like the color property should be ignored on emoji glyphs.
Component: Graphics: Text → PDF Viewer
Product: Core → Firefox
(In reply to Masatoshi Kimura [:emk] from comment #11)
> (In reply to Jonathan Kew (:jfkthame) from comment #10)
> > Maybe pdf.js could use opacity:0 to make the text layer invisible, instead
> > of setting the color?
> 
> Unfortunately it made the selection invisible :(

Hm, yes, that makes it rather less useful.

I suppose the real question is why pdf.js isn't using the "real" font for the text layer, like it does for drawing to the canvas. If it did that, there wouldn't be a problem with fallback finding the color emoji font and becoming visible.
Currently PDF.js doesn't support non-BMP characters when rendering to canvas. So all non-BMP characters will be replaced with PUA code points. (And PDF.js will modify the embedded font accordingly.)
On the other hand, for the selection purpose, PDF.js uses non-BMP code points as-is because they may be pasted into other apps.
(In reply to Masatoshi Kimura [:emk] from comment #12)
> Changing back the component because it looks like the color property should
> be ignored on emoji glyphs.

I don't see how minimized testcase is related to PDF Viewer component
It simply demonstrates that color:transparent (or any other color, AFAIK) is ignored when the color emoji font is used; the glyphs retain their inherent color.

And therefore, if the PDF viewer is going to allow font fallback to happen in the text layer (rather than explicitly using the "correct" font from the PDF), it cannot rely on color:transparent to make the text invisible.
Whiteboard: [pdfjs-c-rendering] → [pdfjs-rendering]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: