[csswg-drafts] [css-fonts] Add new CSS properties math-script-level and math-style (#3746)

fred-wang has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts] Add new CSS properties math-script-level and math-style ==
cc @mrego @emilio @rwlbuis

This proposal introduces two new CSS properties `math-style` and `math-script-level` controlling how the `font-size` evolves inside mathematical constructions.  More generally `math-style` may be used to indicate to implementations of math layout (e.g. MathML) whether [logical height](https://drafts.csswg.org/css-writing-modes-4/#extent) should be minimized. For details, see the [explainer](https://mathml-refresh.github.io/mathml-css-proposals/math-script-level-and-math-style-explainer.html) from the MathML Refresh CG repository.

## Proposal

### CSS `math-style` property

<table>
  <tbody>
    <tr><th>Name:</th><td>'math-style'</td></tr>
    <tr><th>Value:</th><td>display | inline</td></tr>
    <tr><th>Initial:</th><td>inline</td></tr>
    <tr><th>Applies to:</th><td>All elements</td></tr>
    <tr><th>Inherited:</th><td>yes</td></tr>
    <tr><th>Percentages:</th><td>n/a</td></tr>
    <tr><th>Media:</th><td>visual</td></tr>
    <tr><th>Computed value:</th><td>specified keyword</td></tr>
    <tr><th>Canonical order:</th><td>n/a</td></tr>
    <tr><th>Animation type:</th><td>not animatable</td></tr>
  </tbody>
</table>

If the value of `math-style` is 'inline', the math layout on descendants should try to minimize the [logical height](https://drafts.csswg.org/css-writing-modes-4/#extent). This includes how `font-size` is changed when `math-script-level` is 'auto' as well miscelleanous layout rules described for the `displaystyle` attribute of MathML. If the value of `math-style` is 'display', the math layout should not take such constraints into consideration.

### CSS `math-script-level` property

<table>
  <tbody>
    <tr><th>Name:</th><td>math-script-level'</td></tr>
    <tr><th>Value:</th><td>auto | add(&lt;integer&gt;) | &lt;integer&gt;</td></tr>
    <tr><th>Initial:</th><td>inline</td></tr>
    <tr><th>Applies to:</th><td>All elements</td></tr>
    <tr><th>Inherited:</th><td>yes</td></tr>
    <tr><th>Percentages:</th><td>n/a</td></tr>
    <tr><th>Media:</th><td>visual</td></tr>
    <tr><th>Computed value:</th><td>see individual properties</td></tr>
    <tr><th>Canonical order:</th><td>n/a</td></tr>
    <tr><th>Animation type:</th><td>not animatable</td></tr>
  </tbody>
</table>

If the specified value of `math-script-level` is 'auto' and the inherited value of `math-style` is 'display' then the computed value of `math-script-level` is the inherited value.

If the specified value of `math-script-level` is 'auto' and the inherited value of `math-style` is 'inline' then the computed value of `math-script-level` is the inherited value plus one.

If the specified value of `math-script-level` is of the form 'add(&lt;integer&gt;)' then the computed value of `math-script-level` is the inherited value plus the specified integer.

If the specified value of `math-script-level` is of the form '&lt;integer&gt;' then the computed value of `math-script-level` is set to the specified integer.

If `font-size` is specified then `math-script-level` does not affect the computed value of `font-size`. Otherwise, if A is the inherited `math-script-level` and B the computed `math-script-level` then the computed value of `font-size` is obtained by multiplying the inherited value of `font-size` by the nonzero scale factor S<sub>A,B</sub>, defined recursively as follows:
* S<sub>p,p</sub> = 1 for every integer p.
* S<sub>0,1</sub> = `scriptPercentScaleDown` if a nonzero value is provided by the OpenType MATH table of the current font. Otherwise use the suggested default S<sub>0,1</sub> = 0.8.
* S<sub>0,2</sub> = `scriptScriptPercentScaleDown` if a nonzero value is provided by the OpenType MATH table of the current font. Otherwise use the  suggested default S<sub>0,2</sub> = 0.6.
* S<sub>1,2</sub> = S<sub>0,2</sub> / S<sub>0,1</sub>.
* S<sub>p,p+1</sub> = 0.71 for every integer p ≠ 0, 1.
* S<sub>p,q</sub> is the product of the S<sub>i,i+1</sub>'s where i ranges from p to q - 1 for every integers p, q such that q ≥ p + 2 and (p,q) ≠ (0,2).
* S<sub>p,q</sub> = 1 / S<sub>q,p</sub> for every integers p, q such that q < p.

The clamping of `font-size` implied by `font-min-size` and `font-max-size` must apply after the change due to `math-script-level`.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3746 using your GitHub account

Received on Tuesday, 19 March 2019 12:40:42 UTC