Noto Color Emoji doesn't show in Firefox for Linux if fontconfig antialias enabled
Categories
(Core :: Graphics: Text, defect, P5)
Tracking
()
People
(Reporter: i, Assigned: lsalzman, NeedInfo)
Details
(Whiteboard: [gfx-noted])
Attachments
(8 files, 4 obsolete files)
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
Reporter | ||
Comment 11•7 years ago
|
||
Reporter | ||
Comment 13•7 years ago
|
||
Reporter | ||
Comment 14•7 years ago
|
||
Reporter | ||
Comment 15•7 years ago
|
||
![]() |
||
Comment 16•7 years ago
|
||
Comment 17•7 years ago
|
||
Reporter | ||
Comment 20•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Reporter | ||
Comment 21•7 years ago
|
||
Reporter | ||
Comment 22•7 years ago
|
||
Reporter | ||
Comment 23•7 years ago
|
||
Updated•7 years ago
|
Comment 24•6 years ago
|
||
Absolutely true on Fedora 30, FF 69.0.1 (64-bit), NotoColorEmoji.ttf installed.
No "~/.config/fontconfig/fonts.conf" - all emoji render using the Noto emoji font (the differences between the glyphs in Noto and other emoji fonts are not subtle; it's instantly obvious whether it's being used or not).
Antialiasing turned on in "~/.config/fontconfig/fonts.conf" - no emoji at all on some sites (internal company GitLab instance), some sites show some missing.
Comment 25•5 years ago
|
||
Same issue on Fedora 32 with Firefox 77.0.1.
Comment 26•5 years ago
|
||
Workaround via e.g. ~/.config/fontconfig/conf.d/89-color-emoji-no-antialias.conf
:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<description>Disable anti-aliasing for Noto Color Emoji so it works in Firefox (bug 1454152).</description>
<match target="scan">
<test name="family" compare="eq" ignore-blanks="true">
<string>Noto Color Emoji</string>
</test>
<edit name="antialias" mode="assign">
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>false</bool>
</edit>
</match>
</fontconfig>
Comment 27•5 years ago
|
||
It seems that it only occurs when the antialias section is explicitly written in the ~/.config/fontconfig/fonts.conf
file and hinting is disabled:
<match target="font">
<edit name="hinting" mode="assign">
<bool>false</bool>
</edit>
</match>
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>
Now if I remove the antialias section from the file, the emojis just render fine.
Comment 28•4 years ago
|
||
(In reply to sowrensen from comment #27)
It seems that it only occurs when the antialias section is explicitly written in the
~/.config/fontconfig/fonts.conf
file and hinting is disabled:Now if I remove the antialias section from the file, the emojis just render fine.
10 months later it still works, thanks for the workaround. Finally fixed)
Firefox 89.0 Manjaro KDE
Comment 29•4 years ago
|
||
Can confirm I see this exact issue with hinting=false and antialias=true, with Noto Color Emoji.
Fortunately the workaround is a decent one. On most recent Linux systems, fontconfig should come with antialiasing enabled by default. See here for Arch Linux, for example. So removing the explicit enable in the fontconfig should be a no-op, but it apparently does have this affect on Firefox.
I'm doing a reqinfo to the triage owner to try to get this bug marked confirmed. It's still set to new even though it's easily replicated and affects multiple users.
Assignee | ||
Comment 30•4 years ago
|
||
Unfortunately, this is specific intentional behavior in Cairo. See here: https://searchfox.org/mozilla-central/source/gfx/cairo/cairo/src/cairo-ft-font.c#1941
If antialiasing is enabled (which is the default anyway), and if hinting is disabled, then it will explicitly not allow bitmaps. I guess this could be relevant in the case that a font is a scalable outline font, but with some bitmaps none the less, that the intention is to go with the outline?
I can see how on a programmatic level that might make sense in that embedded bitmaps in a font must be hinted, just by virtue of how rendering from a bitmap glyph masks. But, on the flip side, I am not sure the intention makes sense from a configuration stand-point - it seems like a valid configuration that a user just may want to disable hinting...
I am not sure there's a great answer about how to handle this. Do we essentially want to detect if an FT font is not a scalable outline font, and just always allow bitmaps to proceed here? Jonathan, Jeff, thoughts?
Comment 31•4 years ago
|
||
Do we essentially want to detect if an FT font is not a scalable outline font, and just always allow bitmaps to proceed here?
I think so. If the font isn't supposed to be used at all (because it isn't a scalable/outline format), then it should've been excluded at the fontconfig level. Given that the font is exposed as usable, we should go ahead and render it -- so if bitmaps are the only kind of glyphs it contains, we need to use them.
My guess is that this wouldn't affect legacy bitmap-only font formats (such as .pcf), where there is no alternative. I think the feature of excluding "embedded bitmaps" is specifically aimed at primarily-outline formats (OpenType/TrueType/Type1) that supported the provision of bitmaps for specific sizes in addition to the scalable outlines. In this model, the bitmaps are in effect "pre-hinted", fixed renderings for specific pixel sizes, so it makes sense to use them or not according to whether or not hinting is enabled.
What that code didn't anticipate (because it didn't exist at the time it was designed) was the use of the normally-scalable OpenType format to package a font that only contains bitmaps and doesn't include outline glyphs at all. This was a new approach used for color-emoji fonts, where the bitmap is not just a hand-tuned raster version of the primary outline glyph, but the only representation available. It doesn't make sense to ignore the bitmaps in such a font.
Assignee | ||
Comment 32•4 years ago
|
||
The default Cairo-compatible behavior of ignoring all embedded bitmaps in a font
if hinting is disabled and antialiasing is enabled seems to not work with emoji
fonts like Noto Color Emoji which do not have any outlines at all, but do have
color bitmaps that present as scalable. Detect this corner case and allow bitmaps.
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Comment 33•4 years ago
|
||
Comment 34•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Updated•4 years ago
|
Comment 35•4 years ago
|
||
Hi Guo! Are you still experiencing this issue on latest Beta 97.0b9, can you please confirm?
Unfortunately, I was not able to reproduce the bug on an affected Nightly (2021-12-01) build, using Ubuntu 18.04 x64. I've tried to follow the steps from comment 0, and comment 22, but the fonts were always correctly rendered.
Comment 36•3 years ago
|
||
I have reproduced this issue using Firefox 61.0a1 (2018.04.14) on Ubuntu 18 x64 with link: https://guoyunhe.me/demo/noto-color-emoji/.
I can confirm this issue is fixed, I verified using Firefox 98.0 on Ubuntu 18 x64, every emoji is colored.
Comment 37•3 years ago
|
||
Clarification for anyone still seeing this issue:
I can confirm that the issue has been fixed, however if you have the following in your fonts.conf, it will now break in a similar way as before:
<match target="font">
<edit mode="assign" name="embeddedbitmap">
<bool>false</bool>
</edit>
</match>
You might say "well duh, what did you expect? You're explicitly asking for bitmaps embedded in your font files to be disabled." Which is true, however, this is a pretty common way of avoiding the issue where fontconfig will fall back to ugly bitmaps, by simply disabling bitmap fonts entirely. This is what the Arch Wiki suggests: https://wiki.archlinux.org/title/Font_configuration#Disable_bitmap_fonts
Also, including this code doesn't seem to prevent emoji display in any program except Firefox. Firefox seems to interpret these lines as indicating that a selected OpenType font containing bitmaps should not display those bitmaps (i.e. display nothing). Native fontconfig appears to use the lines only in determining which fonts get made available for a given glyph. So if you have Noto Sans Emoji explicitly set as a fallback font for your other fonts (as I do), it continues to work as expected. This is similar to the issue described here, which required a workaround for the hintnone
case. I'm not sure if a similar workaround would be appropriate for the case where the user has embeddedbitmap = false
.
In any case, I'm going to try removing these lines from my fonts.conf entirely, and see if anything breaks. Maybe I don't have any bitmap glyphs in my fonts to act as ugly fallbacks. An alternative (note: not tested) would be to add the following override to your fonts.conf:
<match target="font">
<test qual="any" name="family">
<string>Noto Color Emoji</string>
</test>
<edit name="embeddedbitmap">
<bool>true</bool>
</edit>
</match>
Description
•