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

feat(math): Support MathML bevelled fractions #2165

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

Omikhleia
Copy link
Member

@Omikhleia Omikhleia commented Nov 11, 2024

Bevelled fractions (also known as skewed or diagonal fractions) are displayed with a slanted line (slash) instead of a horizontal bar.

Although this feature is still included in MathML4, it has been excluded from the MathML Core specifications.
As a result, most browsers are unlikely to support bevelled fractions...
But SILE is not a browser -- so it has the freedom to implement a broader standard! 🍰

As stated in the in-code comments, though, MathML4 does not exactly specify how to compute the layout, and the related OpenType math parameters are, at best, unclear1 -- and not pleasant looking; moreover there's no clear distinction for display / cramped / text modes... 🌵

So I went for my own interpretation, also looking at various TeX packages (nicefrac, xfrac) for references. I do like the result:2

image

Oh, as a final note -- I'm going to enter the debate on the insane glyph assembly logic once again... So yes, the proposed code draws a line. A mere line, of appropriate thickness (incl. the linethickness attribute when specified) 🍭

Footnotes

  1. After writing this, I found a ConTeXt manual (Hans Hagen & Mikael P. Sundqvist, Mathematics in ConTEXt, August 7, 2024 edition): SkewedFractionHorizontalGap and SkewedFractionVerticalGap "do not make sense (for us) so we do not use them." -- It's an interesting reading, by the way.

  2. I don't think lowering the fraction with respect to the baseline is the right thing to do. But see previous note: the mentioned ConTeXt book does it. Well, with plenty of other options etc. -- Likely beyond our own scope for now.

@Omikhleia Omikhleia added the enhancement Software improvement or feature request label Nov 11, 2024
@Omikhleia Omikhleia self-assigned this Nov 11, 2024
@Omikhleia Omikhleia requested a review from a team as a code owner November 11, 2024 19:36
@Omikhleia Omikhleia added this to the v0.15.6 milestone Nov 11, 2024
@Omikhleia
Copy link
Member Author

Omikhleia commented Nov 12, 2024

On my note:

the related OpenType math parameters are, at best, unclear

I just received this Building OpenType math fonts link. N.B. I don't see that comment being posted here, so maybe the author (whom I'll therefore keep anonymous) didn't want it public? But thanks for the link, fairly instructive too!

I still think it's unclear to me what the real-life expectations are: ".... so that the bottom right of the numerator as at the top left of the denominator" -- So a / b would be different from a / c, q / b or q / a .... due to bounding boxes being used? (= ascender/descender-wise?) -- Something seems ill-defined, or I can't read between the lines?

It's not as if the W3C test suite had useful examples rather than "fake" scenarios not occurring in real life... I don't think anyone would need this "dumb" example (no, I don't have to be gentle or subtle heh1 :), but here it is anyway:

image

Well, it doesn't prove anything obviously (except we'd be passing that test, I guess)

Footnotes

  1. I am in playful mode: A math language considering a binomial is a fraction with a 0-thick rule can claim being "presentational" indeed. Just they shouldn't have called the tag "mfrac", right? (mumbles: "20+ years of specifying things without knowing their semantics?" 😹 )

@alerque alerque force-pushed the feat-bevelled-fractions branch from 31b1bff to 567ac54 Compare November 13, 2024 21:58
@alerque alerque merged commit 69cae1e into sile-typesetter:master Nov 13, 2024
20 checks passed
@Omikhleia Omikhleia deleted the feat-bevelled-fractions branch November 23, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants