W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2020

Re: [csswg-drafts] [css-fonts-4] Managing the scaling of font-size within MathML rendering (#5389)

From: Mike Bremford via GitHub <sysbot+gh@w3.org>
Date: Tue, 04 Aug 2020 10:40:52 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-668521706-1596537651-sysbot+gh@w3.org>
We'd implemented the original `math-script-level` property while the core spec was evolving. For what it's worth, this proposal looks a lot better to me. An awful lot better.

Only one suggestion really - would it be an idea to reset the internal script-level to 0 if the font-size is specified as anything other than a `scriptlevel()` function?

I ask because, as specified, "the internal scriptlevel is 0 on the root element" - that's the root element of the document, not of the math equation?

If so, then my issue is that I can't reset the internal script level _and_ change the font-size at the same time. And I don't see anything that limits the use of this to MathML element only. 

<html style="font-size: 16px"> <!-- root element. script-level starts at 0 -->
 <div style="font-size: scriptlevel(1)">
  This text is 11.36px
  <div style="font-size: 16px">
   This text is 16px again, because the font-size was specified as a length, not a `scriptlevel()` function.
    <mtext>This is still 16px</mtext>
    <munderover> <!-- user-agent stylesheet increments script-level of 2nd and 3rd children -->
     <mi>a</mi> <!-- I'd expected 11.36px, but it's actually 8px because scriptlevel is 2, not 1 -->
I could get around this by adding `font-size: scriptlevel(0)` to the `<math>` element. But if I also wanted to set the `font-size` on the math element to something constant like 20px, I couldn't do both.

It's obviously not very likely, but having a property like internal-script-level that isn't visible to the user, that inherits all the way through the node hierarchy and that can't be reset without also resetting another property feels a little sketchy. The above would be a real pig for an author to debug.

I don't know how often a fixed font-size is used for internal elements in MathML - in our batch of testcases here, only once, within an `<mtable>`. Resetting the script-level to zero at that point looks reasonable to me.

In short, my only suggestion would be to

1. Reset the internal-script-level to 0 if font-size is set to anything other than a `scriptlevel()` function
2. Add `math { font-size: scriptlevel(0) }` to the MathML user-agent stylesheet.

The combination shuold ensure that a `<math>` element always starts with an internal-script-level of 0, whether the user specifies a font-size on the math element or not.

Alternatively, specify that the internal script-level is reset to 0 on a `<math>` element by some internal means unrelated to the `font-size` property.

GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5389#issuecomment-668521706 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 4 August 2020 10:40:55 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:13 UTC