-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mechanism to determine the default font-family / font-size on the <math> tag #37
Comments
This was also reported in the MathMLinHTML5 implementation note ( https://gitlab.com/mathml/MathMLinHTML5/issues/26 ): 'From http://www.mathml-association.org/MathMLinHTML5/output/S2.html#SS3.SSS2: This is maybe too specific to Gecko's implementation. The note should probably just suggest to make the user agent stylesheet change the font-family in order to force the selection of a math font. To solve size inconsistency between the text font and math font, maybe introduce a new CSS keyword for font-size ("auto-adjust", "match-parent" or something like that) that would tell the CSS engines to automatically adjust the font-size of an element to take into account font-family change, so that the text height remains the same. See https://phabricator.wikimedia.org/T132607' |
The above URL changed: https://mathml-refresh.github.io/mathml-core/#cssuseragent |
One thing I was thinking about would be to define a "font-family: math" to have the browsers search for a math font and give the possibility to make the list of math fonts configurable. Firefox currently relies on an internal "math" lang instead but that's not the mechanism we have in WebKit/Chromium |
|
@faceless2 Thanks for the information, that's great. Then if the CSS WG already agreed about it we could just implement it in browsers. |
@fred-wang: At the meeting today, we discussed math fonts and specifying the font to use via CSS. I asked about having to use a Web font because most users don't have math fonts on their machines. That could be remedied if every browser included at least one math font when they did the install. Any idea of whether there are plans to include one in the Chrome download? Does Firefox include any (STIX?) when it is downloaded? |
This has been discussed for years. I don't think this is something likely to happen (especially on mobile browser, as long as we don't do w3c/mathml-core#122 to reduce font-size). There is already Cambria on Windows and as I said I pinged Apple regarding upgrading the pre-installed STIX font on mac. We could talk about #330 again with Google. There is a bug to bundle font in Firefox, but again I don't think that will happen anytime soon. For now the best we can have is https://addons.mozilla.org/en-US/firefox/addon/mathml-fonts (which should work in any browser). Anyway, I think this is orthogonal to this issue, which is just about trying to pick available math fonts when possible instead of just using text ones. Pre-installed fonts is out of the decision of this CG. I suspect having more native mathml users would help to convince maintainers about the importance of math fonts. |
Consensus from 2020/03/23: use font-family: math spec updated |
…23786) * Add MathML test to check the default font-family on the <math> root. w3c/mathml#37 * Check that non-inherited is math
test added so closing |
…t-family on the <math> root., a=testonly Automatic update from web-platform-tests Add MathML test to check the default font-family on the <math> root. (#23786) * Add MathML test to check the default font-family on the <math> root. w3c/mathml#37 * Check that non-inherited is math -- wpt-commits: 4d53adfdfb1d6298ac51c6db31256c0c3562659e wpt-pr: 23786
…t-family on the <math> root., a=testonly Automatic update from web-platform-tests Add MathML test to check the default font-family on the <math> root. (#23786) * Add MathML test to check the default font-family on the <math> root. w3c/mathml#37 * Check that non-inherited is math -- wpt-commits: 4d53adfdfb1d6298ac51c6db31256c0c3562659e wpt-pr: 23786
Currently WebKit has some default list of math font-family to try on the math root in the user agent stylesheet. Gecko has "font-family: sans-serif;" but also some preferences for math font that can be configured using the standard font menu of Firefox (it relies on a "math" lang).
https://trac.webkit.org/browser/trunk/Source/WebCore/css/mathml.css
https://dxr.mozilla.org/mozilla-central/source/layout/mathml/mathml.css
"Finally, one of the most important issue is the choice of the math font.
Note that most stylistic math properties are actually included in the
font itself so it's great that authors can just use the CSS font-family
to select their preferred fonts (possibly provided as Web fonts), and
make it consistent with the rest of the page. However, to determine the
default math fonts, some mechanisms should probably be formalized and
implemented in web engines:
Text fonts are not appropriate for math layout. Hence making the
element inherit the text font is a very bad idea. Ideally, web
engines should have a mechanism to try and find math fonts in the
specified CSS font-family lists and to fallback to known math fonts on
the system.
One consequence is that we are likely to get different text and math
fonts and so inconsistent font-size. Instead of making the
element inherit the font-size, Web engines should probably have a
mechanism to automatically adjust the font-size.
Even with this adjustment, the style of the font faces of the text
and math fonts may be inconsistent. Many text fonts have a math
companion e.g. STIX / STIX Math, Latin Modern Roman / Latin Modern Math,
DejaVu Serif / DejaVu Math TeX Gyre etc It would be good to have a
mechanism to map a font to its math companion (probably this should be
discussed on the Open Font Format mailing list). Then the font-family
can be determined using this mapping and this solves all the issues of
inconsistent style and font-size.
So to summarize, the idea to determine the default font-family /
font-size on the element would be: a) find a math font that fits
best (font-size and fontface style) with the inherited font-family and
b) adjust the font-size if necessary to match the parent font-size."
Original report: https://lists.w3.org/Archives/Public/www-math/2016Jul/0025.
The text was updated successfully, but these errors were encountered: