Implement font-family: math
Categories
(Core :: MathML, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox145 | --- | fixed |
People
(Reporter: fredw, Assigned: eri)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
Currently we implement the default math font selection via an internal x-math lang (bug 947654) and it's configurable via the font preference menu.
We could instead use font-family: math
https://drafts.csswg.org/css-fonts/#valdef-font-family-math
https://w3c.github.io/mathml-core/#the-top-level-math-element
| Reporter | ||
Updated•3 years ago
|
Replaces the internal x-math lang for the CSS Fonts Level 4
font-family: math generic font family.
Updated•7 months ago
|
Updated•6 months ago
|
Updated•6 months ago
|
Comment 2•6 months ago
|
||
Suppose I understand the logic of this patch and gfxFcPlatformFontList::AddGenericFonts function correctly, does it mean that after this patch is merged, if I want Firefox to use the fonts directly queried from fontconfig for the generic family math. In that case, I need to turn on mathml.font_family_math.enabled (of course this is the default in nightly), and set font.name.serif.x-math (empty by default) and font.name-list.serif.x-math (a series of fonts predefined by Firefox by default) to empty?
(In reply to Celeste Liu [:Coelacanthus] from comment #2)
Suppose I understand the logic of this patch and
gfxFcPlatformFontList::AddGenericFontsfunction correctly, does it mean that after this patch is merged, if I want Firefox to use the fonts directly queried from fontconfig for the generic familymath. In that case, I need to turn onmathml.font_family_math.enabled(of course this is the default in nightly), and setfont.name.serif.x-math(empty by default) andfont.name-list.serif.x-math(a series of fonts predefined by Firefox by default) to empty?
I have just tested this. You only need to set mathml.font_family_math.enabled and font.name.serif.x-math = "math", as name seems to have priority over name-list. With that I was able to change the font with fontconfig preferences.
Comment 4•6 months ago
|
||
That's what I would expect, yes. (Thanks for testing it!) The font.name.* pref comes first (if non-empty), and then the list from font.name-list.* is appended to that; and (on Linux) each family-name found is then passed to fontconfig to be resolved. So just setting font.name.serif.x-math = "math" should mean that the first-choice font for math content will be whatever fontconfig returns for math.
Actually, I think we should probably include math at the beginning of the font.name-list.serif.x-math pref on Linux, so that this happens by default. This is what we do for the other generics (serif, sans-serif, etc): we just map them to the same names and let fontconfig resolve them. But that will potentially change behavior quite significantly (suddenly making use of the fontconfig math generic, where previously we used an internal list of common math fonts), so we should do that change in a separate bug.
(In reply to Jonathan Kew [:jfkthame] from comment #4)
That's what I would expect, yes. (Thanks for testing it!) The
font.name.*pref comes first (if non-empty), and then the list fromfont.name-list.*is appended to that; and (on Linux) each family-name found is then passed to fontconfig to be resolved. So just settingfont.name.serif.x-math = "math"should mean that the first-choice font for math content will be whatever fontconfig returns formath.Actually, I think we should probably include
mathat the beginning of thefont.name-list.serif.x-mathpref on Linux, so that this happens by default. This is what we do for the other generics (serif,sans-serif, etc): we just map them to the same names and let fontconfig resolve them. But that will potentially change behavior quite significantly (suddenly making use of the fontconfigmathgeneric, where previously we used an internal list of common math fonts), so we should do that change in a separate bug.
That sounds good. But I agree with doing it on a different bug, the behaviour is very different. For example, on my Firefox build container, the default math family order in fontconfig was "XITS Math", then "STIX Two Math", then "Latin Modern Math", so it was quite different than the one currently in Firefox.
Backed out for causing wpt failures @math-global-event-handlers.tentative.html.
- Backout link
- Push with failures
- Failure Log wpt failures
- Failure Log wr failures
(In reply to agoloman from comment #8)
Backed out for causing wpt failures @math-global-event-handlers.tentative.html.
- Backout link
- Push with failures
- Failure Log wpt failures
- Failure Log wr failures
UPDATE: The wpt failures were not caused by this patch, only the WR failure
| Assignee | ||
Comment 10•5 months ago
|
||
So sorry about that, I'm still trying to figure out what tests are best to run at each point, so the Wr failures slipped by. I came across the Unicode PUA test before so I have an idea of what I missed. I'll upload a fix for that in a bit.
Comment 11•4 months ago
|
||
Comment 12•4 months ago
|
||
| bugherder | ||
Comment 13•3 months ago
|
||
MDN docs changes can be tracked in the following GitHub issue: https://github.com/mdn/content/issues/41506
Updated•3 months ago
|
Description
•