w3c / w3c/mathml-core

minsize adjustment when target size T = Tascent + Tdescent ≤ 0

Open
#230 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
56
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Extracting from #103

Another thing we might revise is the case T ≤ 0. In practice this is really T = 0 and happens when all non-stretchy siblings have zero height/depth or that we try to determine unstretched sizes when the mrow only contains stretchy elements as shown in the testcase below. The scaling adjustment cannot be performed (division by zero) and it was probably just an edge case (does not happen in practice) so the default choice to set symmetric minsize/2 above and below the baseline (math axis with the latest fix) is fine. However, Firefox/WebKit don't seem to do that when the operator does not have the symmetric property.

I'm thinking we could instead to do something like this:

  1. If the operator has the symmetric property then continue to set the Tascent
    to minsize / 2 + AxisHeight and Tdescent to minsize − Tascent.
  2. Otherwise (if the operator does not have the symmetric property), set Tascent / Tdescent to the ascent/descent of the unstretched glyph, scaled proportionately to meet the minsize i.e. Tascent = glyphascent * minsize / glyphheight and Tdescent = minsize - Tascent.

In particular, when minsize is the default 100% and the operator does not have the symmetric property, then Tascent/Tdescent would just be the ascent/descent of the unstretched glyphs, so that unstretched glyph can just be used to render the stretched operator. Also Δ = 0 in step 6 and the unstretched glyph preserves its vertical alignment with respect to the baseline.

That said, I'm not even sure about the desired vertical alignment for operators and stretched glyph selection, even when there is only one non-stretchy element. See https://github.com/w3c/mathml-core/issues/205#issuecomment-2034350739 for a testcase.

<!DOCTYPE html>
<link
  rel="stylesheet"
  href="https://fred-wang.github.io/MathFonts/LatinModern/mathfonts.css" />
<meta charset="UTF-8">
<style>
  math { font-size: 32pt; }
</style>
<!DOCTYPE html>
<link
  rel="stylesheet"
  href="https://fred-wang.github.io/MathFonts/LatinModern/mathfonts.css" />
<meta charset="UTF-8">
<style>
  math { font-size: 32pt; }
</style>
<math display="block">
  <mrow>
    <mo symmetric="false">|</mo>
    <mpadded height="0" depth="0"><mn></mn></mpadded>
  </mrow>
  <mn>__−</mn>
  <mrow>
    <mo symmetric="false">(</mo>
    <mo symmetric="false">)</mo>
  </mrow>
</math>
<math display="block">
  <mrow>
    <mo minsize="5em" symmetric="false">|</mo>
    <mpadded height="0" depth="0"><mn></mn></mpadded>
  </mrow>
  <mn>__−</mn>
  <mrow>
    <mo minsize="5em" symmetric="false">(</mo>
    <mo minsize="5em" symmetric="false">)</mo>
  </mrow>
</math>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MathML Core stretching-operators algorithm and the embedded testcase, then compare the proposed T ≤ 0 behavior with the linked issue #205 testcase. The desired vertical alignment and stretched-glyph selection remain unresolved, so confirm the expected behavior before changing the specification; done means the rule and testcase expectations are agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.