allow font-delivered "icons" even when browser.display.use_document_fonts = 0 (forced font override)
Categories
(Core :: Layout: Text and Fonts, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox111 | --- | fixed |
People
(Reporter: mozilla, Assigned: jfkthame)
References
Details
Attachments
(4 files)
Updated•8 years ago
|
Assignee | ||
Comment 1•8 years ago
|
||
Assignee | ||
Comment 3•8 years ago
|
||
Updated•8 years ago
|
Hi,
can someone please verify if this code snippet is affected by this bug, or if it is bad implementation of the Material Icons web font? I've somehow got Font Awesome working for me with forced document fonts, but this one fails to load properly. If the use_document_fonts property is set to 1, it works instantly. I think (might be mistaken!) key in FA was installing the font locally, which didn't help here. This is the first occurrence of web font issue after FA was resolved - I just happened to install ioBroker to my RPi, which seems heavily infested with web font icons. Mid-term goal (if ioBroker works for me) would be using it with Firefox, which is out of reach with the current rendering and no option to selectively disable use_document_fonts for specific URLs. I'll attach a screenshot as well.
<div class="user-view center">
<a id="current-user-icon"><i class="large material-icons">account_circle</i></a>
<a><span class="white-text name" id="current-user">admin</span></a>
<a><span class="white-text email" id="current-group">Administrator</span></a>
</div>
Assignee | ||
Comment 7•4 years ago
|
||
Yes, this is the issue you're seeing; it's the natural result of how the Material Icons font is encoded & used.
FontAwesome uses Private Use Area codepoints, so it can still work with use_document_fonts set to 0, as the default font won't include those codepoints. Material Icons, on the other hand, uses regular English characters, so naturally they get displayed in the default font when you've told the browser not to use what the website asks for. (See also bug 1638585.)
Comment 9•2 years ago
|
||
Since this appears to be difficult to solve in Firefox, I was hoping that Greasemonkey could do this more flexibly. E.g. having a white list of popular icon fonts.
Unfortunately, it seems limitations in Firefox prevents a Greasemonkey script from doing the same thing:
https://github.com/greasemonkey/greasemonkey/issues/3151
https://bugzilla.mozilla.org/show_bug.cgi?id=1393022
Perhaps that functionality can be prioritised as a way of resolving this use case?
Updated•2 years ago
|
Updated•2 years ago
|
Comment 11•2 years ago
•
|
||
I'm copying over two comments from dupe bug 1638585, which include a possible way forward & a motivating use-case (i.e. why users might be affected by this):
(Quoting nyanpasu64 from bug 1638585 comment #5)
One possible solution is to add a whitelist of font names to let through, populated with "Material Icons" and users can add more fonts via about:config.
(Quoting Vincent Lefevre from bug 1638585 comment #6)
There may be several reasons to use browser.display.use_document_fonts = 0, but one of them (this is my case) is for readability reasons for text, and in this case this should not apply to word-ligature icon fonts. There should be a way to detect such fonts at some level. But the suggested whitelist solution would probably work in practice, and if there is some default, here are the names I could find:
- Material Icons
- Google Material Icons
- Material Symbols Outlined
- Material Symbols Rounded
- Material Symbols Sharp
Vincent also mentioned that "Matching exact names would probably not be sufficient", and suggested a substring-matching approach -- but I think that exact-matching is probably the best approach to start with, since the number of affected fonts is relatively small, and the complexity (and potential for false positives) would be quite higher if we took a substring-matching-based (or regex-based) approach. Exact string matching has the benefit of being predictable and allowing for users (possibly with the assistance of add-ons) to understand and trivially hand-edit their own allow-list (without needing to understand regex/substring-matching syntax), if needed.
Also: gaming things out, it's worth entertaining a small adversarial concern along the lines of: "Uh oh, now font/site developers might be incentivized to co-opt these icon/symbol font names for completely-unrelated web-fonts, simply to increase the likelihood that the browser will use the site's chosen font despite user preferences." But I suspect in reality there's no strong motivation for sites to get up to this sort of mischief, since the share of users with this configuration (who they'd be focusing on with this sneakiness) is probably quite small.
Assignee | ||
Comment 12•2 years ago
|
||
Updated•2 years ago
|
Assignee | ||
Comment 13•2 years ago
|
||
It's a bit of a hack, but here's a possible patch that adds support for an icon-font whitelist for family names that should continue to be used even when use_document_fonts is disabled.
I initialized the list with the family names quoted in comment 11, plus additional Material Icons versions that I see on Google Fonts; obviously, we may need to add more fonts to the list as we run across them.
Comment 14•2 years ago
|
||
Comment 15•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•