@font-face rules can interfere with generic-font prefs

RESOLVED FIXED

Status

()

Core
Layout: Text
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

Trunk
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 2 obsolete attachments)

(Assignee)

Description

6 years ago
CSS generics such as 'serif' are mapped to (language-dependent) font family names on the platform via the font preferences such as font.default.serif.x-western.

However, if a @font-face rule happens to use the same family name as was used in the font prefs, the downloaded font will be used instead of the original platform font.

Is this expected behavior? It seems wrong to me; I'd expect the mapping of generics to platform fonts via the preferences to be unaffected by @font-face usage on the page.
(Assignee)

Comment 1

6 years ago
Created attachment 543384 [details]
example of the unexpected effect of @font-face on prefs fonts

This demonstrates the unexpected interaction on OS X, and should work similarly on Windows AFAICS.
(Assignee)

Comment 2

6 years ago
Created attachment 543387 [details]
fixed example so it demonstrates the issue on Windows as well
Attachment #543384 - Attachment is obsolete: true
(Assignee)

Comment 3

6 years ago
Created attachment 543419 [details] [diff] [review]
patch, don't look up prefs font families in the user font set

Assuming the current behavior is not actually wanted, here's an attempt to fix it by passing a flag in gfxFontGroup::ForEachFontInternal to tell it whether it should be checking the user font set or not.
Assignee: nobody → jfkthame
Attachment #543419 - Flags: review?(jdaggett)
(Assignee)

Comment 4

6 years ago
Created attachment 543420 [details] [diff] [review]
reftest
Attachment #543420 - Flags: review?(jdaggett)
(Assignee)

Comment 5

6 years ago
Created attachment 543525 [details] [diff] [review]
patch, don't look up prefs font families in the user font set

Updated to fix build failure on Linux.
Attachment #543419 - Attachment is obsolete: true
Attachment #543525 - Flags: review?(jdaggett)
Attachment #543419 - Flags: review?(jdaggett)

Comment 6

6 years ago
Comment on attachment 543525 [details] [diff] [review]
patch, don't look up prefs font families in the user font set

Looks good but we really need to clean up the generic family code at some point, it's somewhat silly that we're parsing "serif" at this level.  dbaron and I talked about this briefly in the past, I think we should be passing in a font list in an array with generics as special tokens, since the style system has already resolved these.  But that's going to take a lot of effort to untangle existing code across platforms.
Attachment #543525 - Flags: review?(jdaggett) → review+

Updated

6 years ago
Attachment #543420 - Flags: review?(jdaggett) → review+
...which is bug 280443 (at least mostly).
(Assignee)

Comment 8

6 years ago
http://hg.mozilla.org/mozilla-central/rev/51b49a7cf2e4 (patch)
http://hg.mozilla.org/mozilla-central/rev/fe33af7f6fa9 (test)
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
(Assignee)

Comment 9

6 years ago
Argh, this caused a build failure in gfxFT2Fonts on Android.
Backed out:
http://hg.mozilla.org/mozilla-central/rev/854daee4377c
http://hg.mozilla.org/mozilla-central/rev/84bc1d07bacc
http://hg.mozilla.org/mozilla-central/rev/931f06b80727
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 10

6 years ago
Re-landed, with the android bustage fixed:
http://hg.mozilla.org/mozilla-central/rev/812aa60517a7
http://hg.mozilla.org/mozilla-central/rev/64ee37ef692e
Status: REOPENED → RESOLVED
Last Resolved: 6 years ago6 years ago
Resolution: --- → FIXED
(Assignee)

Updated

6 years ago
Depends on: 671385

Updated

6 years ago
Depends on: 672951
You need to log in before you can comment on or make changes to this bug.