Skip to content
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

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

Open
fred-wang opened this issue Apr 5, 2024 · 0 comments
Open

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

fred-wang opened this issue Apr 5, 2024 · 0 comments

Comments

@fred-wang
Copy link
Contributor

fred-wang commented Apr 5, 2024

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 #205 (comment) 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant