Closed Bug 395866 Opened 17 years ago Closed 17 years ago

font fallback does not respect stylesheet font list

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: jtd, Assigned: masayuki)

Details

Attachments

(3 files)

When a style specifies a list of fonts, the first font found is used for elements that use this style.  However, if that font does not contain glyphs for a given substring within a text run, the font fallback code immediately starts with fonts defined in user preferences.  It should be searching through the list of fonts in the style's font list first before using user or system-specified substitutes.

Steps:

1. Check to verify that Japanese fonts are installed (look for Hiragino xxx in Font Book).  Install if needed.
2. Open the testcase.

Result: the first example of Japanese text renders correctly, the second one does not.
Flags: blocking1.9?
Attached file testcase
Related bugzilla-jp bug:

http://bugzilla.mozilla.gr.jp/show_bug.cgi?id=5858

Attached patch Patch rv1.0Splinter Review
Thanks, John.

I think this is correct. kATSULastResortOnlyFallback doesn't use non-first fonts in fallback font list. I think kATSUSequentialFallbacksExclusive is correct. But it uses non-listed fonts. (It seems that the behavior is different from the ATSUI reference.)

Therefore, we need to check whether the substituteFontID is listed in the fontgroup.
Assignee: jdaggett → masayuki
Status: NEW → ASSIGNED
Attachment #280630 - Flags: review?(vladimir)
er, And I changed FindATSUFont. It adds many fonts which is added already. E.g., when the fonts of font-family property and pref fonts have common fonts.
From my testing today, this appears to fix the problem.  It also eliminates the inclusion of the same font multiple times (yay!).  I'm still a little concerned about the structure of this code though, the font matching loop in gfxAtsuiFontGroup::InitTextRun is getting a bit unwieldy.

Based on discussions with Stuart, I think it makes sense to try and move some of Stuart's font selection code for Windows that scans font cmap's to the Mac and avoid the use of ATSUMatchFontsToText if possible.
er, if the font style is system fonts, should we use kATSUSequentialFallbacksPreferred at first time? (i.e., the second loop is not needed at that time?)
(In reply to comment #7)
> er, if the font style is system fonts, should we use
> kATSUSequentialFallbacksPreferred at first time? (i.e., the second loop is not
> needed at that time?)

oops, if we do so, the CJK text in menus may be broken on non-CJK locales. we need another approach, but it's out of scope of this bug.
Flags: blocking1.9? → blocking1.9+
(In reply to comment #8)
> oops, if we do so, the CJK text in menus may be broken on non-CJK locales. we
> need another approach, but it's out of scope of this bug.

So the patch as it stands is fine, font fallback to fonts in the CSS font-family list occurs correctly and we don't include the same font in the list several times.
checked-in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
Component: GFX: Mac → GFX: Thebes
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: