Open Bug 387410 Opened 17 years ago Updated 1 year ago

Should use Last Resort font for missing glyphs on OSX

Categories

(Core :: Graphics: Text, defect)

x86
macOS
defect

Tracking

()

REOPENED

People

(Reporter: vlad, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch use last resort font for missing glyphs (obsolete) (deleted) — Splinter Review
OSX provides a Last Resort font with a graphical representation of each codepoint's range.  We should use this instead of our own missing-glyph drawing, because it looks nicer.

However, our drawing gives more info (the actual codepoint) -- so maybe this should be a pref?
Attachment #271516 - Flags: review?(roc)
imho, we should just make our stuff look nicer
Using Last Resort is what's expected on the Mac and what other apps do (as well as what Gecko 1.8 does in some[1][2], but not all, cases).  In addition, in cases like this[3], Firefox would be using Last Resort in the titlebar but displaying the same exact text in the tab title (and page content) using GeckoBox, which seems ugly/wrong.

[1] Vlad's testcase from bug 364786: https://bugzilla.mozilla.org/attachment.cgi?id=271057
[2] Ahasuerus in an smontagu blog post: http://www.smontagu.org/blog/?p=291

[3] http://ml.wikipedia.org/
Blocks: 375507
(In reply to comment #0)

> However, our drawing gives more info (the actual codepoint) -- so maybe this
> should be a pref?

The "Last Resort" font does have the codepoint shown, although it's effectively hidden in the border such that you need to zoom in to see it.
The borders of the Last Resort glyphs contain the *range* of code points associated with the script, not the specific code point that was used in the document.
Oops, right you are. I blame poor eyesight. :-)
Assignee: vladimir → nobody
One small note: there are actually codepoints for which the Last Resort font will not contain glyphs.  Examples: U+037B, U+037C, U+037D, Greek editorial symbols.  These are definitely exceptional cases, but it means that we need to test the Last Resort font codepoints before assuming there are glyphs.
Assignee: nobody → jdaggett
Depends on: 396732
No longer depends on: 364786
Note that this font is now available for other OSes: http://www.unicode.org/policies/lastresortfont_eula.html
On Linux it seems the font Just Works.
I installed the font on Windows as well, and I notice that sometimes it is kicking in for scripts that I already had fonts for. I need to go back and recheck that that didn't happen on Linux, but I see no reason in principle why it shouldn't unless we add special code to make sure that it actually is used only as a last resort.
Marking this as WONTFIX because no decision has been made about whether or not to deploy this. Please re-open if you want to discuss more.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
Assignee: jdaggett → nobody
I didn't know what I was doing when I WONTFIX'd this, sorry.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
(In reply to Simon Montagu from comment #9)
> I installed the font on Windows as well, and I notice that sometimes it is
> kicking in for scripts that I already had fonts for. I need to go back and
> recheck that that didn't happen on Linux, but I see no reason in principle
> why it shouldn't unless we add special code to make sure that it actually is
> used only as a last resort.

Indeed, unless the font is somehow "hidden" from the normal font-list that we search when we need to do fallback for characters not available in the current CSS font-family, there's a risk that Last Resort may be chosen.

Mac OS X doesn't suffer from this because the Last Resort font is not included in the font list returned from NSFontManager, but if we're going to encourage people to install it on other OSes then this could become an issue for them - possibly affecting other applications that do fallback, too.
Comment on attachment 271516 [details] [diff] [review]
use last resort font for missing glyphs

Marking Vlad's gfxAtsuiFont patch as obsolete; that code is long gone. If we want to use Last Resort for fallback in preference to hexboxes, we'll need a fresh patch. (And I think a different approach, based on extending gfxFontGroup::FindFontForChar, might make the most sense in the current codebase.)
Attachment #271516 - Attachment is obsolete: true
(In reply to Jonathan Kew (:jfkthame) from comment #12)
> Indeed, unless the font is somehow "hidden" from the normal font-list that
> we search when we need to do fallback for characters not available in the
> current CSS font-family, there's a risk that Last Resort may be chosen.

I just had this issue. I was on the "Transliteration of Ancient Egyptian" Wikipedia page and text that should have been rendered in the Aegyptus font was instead a series of almost black blocks. Took me an hour to track down what was going on. I uninstalled the Last Resort font from my system and reloaded Firefox and the text was properly showing in the Aegyptus font.

Out of curiosity, why hasn't Firefox implemented a font fallback tweaking yet? There are many occasions where I shake my head when the fallback font chooses a glyph inside a word that was in a very different style from the font of the rest of the word and I think to myself "it should have used xxx font instead".
(In reply to busi.bugzilla from comment #14)
> (In reply to Jonathan Kew (:jfkthame) from comment #12)
> > Indeed, unless the font is somehow "hidden" from the normal font-list that
> > we search when we need to do fallback for characters not available in the
> > current CSS font-family, there's a risk that Last Resort may be chosen.
> 
> I just had this issue. I was on the "Transliteration of Ancient Egyptian"
> Wikipedia page and text that should have been rendered in the Aegyptus font
> was instead a series of almost black blocks. Took me an hour to track down
> what was going on. I uninstalled the Last Resort font from my system and
> reloaded Firefox and the text was properly showing in the Aegyptus font.
> 
> Out of curiosity, why hasn't Firefox implemented a font fallback tweaking
> yet? There are many occasions where I shake my head when the fallback font
> chooses a glyph inside a word that was in a very different style from the
> font of the rest of the word and I think to myself "it should have used xxx
> font instead".

When I experimented with using the Last Resort font as a replacement for hexcode boxes, it impacted overall page load times.

Under OSX, we use CoreText to select a suitable fallback in cases where commonly used fonts don't contain a glyph. This is done for performance reasons, it's too costly perf wise to do iterate over all fonts to determine a font. You can explicitly enable this using the pref below in about:config:

gfx.font_rendering.fallback.always_use_cmaps ==> true

This should pick up the Aegyptus font you were using. Another option would be to explicitly load a font for pages that use scripts rarely supported by common system fonts using @font-face.
Severity: normal → S3
Component: Graphics → Graphics: Text
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: