Hi,
Le 18/10/2025 à 19:51, PhistucK a écrit :
Hmmm how does it know whether to mirror or not to mirror? And what
will be mirrored?
Is there an example/demo of failure, success and fix-dependent success
renderings?
First note that right-to-left layout of MathML formulas as well as text
mirroring inside MathML formulas is already supported. For example
Chromium lays out the following formula from right-to-left and mirrors
summation, "element of" and right/left fences (but not the rest of the
text):
<!DOCTYPE html>
<meta charset="utf-8"/>
<link rel="stylesheet"
href="https://fred-wang.github.io/MathFonts/XITS/mathfonts.css">
<math dir="rtl" display="block">
<mrow>
<munderover>
<mo largeop="false">∑</mo>
<mrow>
<mi>n</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mn>∞</mn>
</munderover>
<mfrac>
<mn>1</mn>
<msup>
<mi>n</mi>
<mn>2</mn>
</msup>
</mfrac>
</mrow>
<mo>∊</mo>
<mrow>
<mo stretchy="false">(</mo>
<mfrac>
<mn>3</mn>
<mn>2</mn>
</mfrac>
<mo>,</mo>
<mfrac>
<mn>7</mn>
<mn>4</mn>
</mfrac>
<mo stretchy="false">]</mo>
</mrow>
</math>
Attached file rtl-math.html uses largeop="true" and stretchy="true"
instead: the summation symbol is drawn bigger, the fences are stretched
vertically but mirroring no longer happens (see attached screenshot
rtl-math-chrome-canary-experimental-web-platform-features-disabled.png).
This intent is trying to fix the latter while still preserving the
largeop/stretchy feature (see
rtl-math-chrome-canary-experimental-web-platform-features-enabled.png
for how it should look like). I believe that gives you an example of
failure, success and fix-dependent success renderings.
As I said, right-to-left layout of formulas is described in the MathML
Core spec, covered by tests and already implemented in Chromium.
Regarding mirroring technique of text (character-level and glyph-level
mirroring) they are described outside MathML Core, and that spec was
amended to use these techniques for largeop/stretchy operators. You can
find demos and more details on the explainer:
https://people.igalia.com/fwang/mathml-operator-mirroring-explainer.html
Does the dir="rtl" attribute have to be specified specifically on
<math>, or will it inherit the directionality of the ancestor?
Hebrew, as far as I am aware, uses left-to-right for written math, so
inheriting regardless of the language would not be correct for Hebrew,
I think?
You are right regarding Hebrew. Actually even in some Arabic countries
text is written from right-to-left but mathematical formulas remain in
left-to-right direction. That's why the default UA sheet for MathML sets
"direction: ltr" on the <math> element:
https://w3c.github.io/mathml-core/#user-agent-stylesheet ; so indeed
it's necessary to use an explicit dir="rtl" (which is mapped to
direction: rtl).
Hope that answers your questions,
Frédéric
☆*PhistucK*
On Tue, Oct 14, 2025 at 2:53 PM Chromestatus
<[email protected]> wrote:
*Contact emails*
[email protected], [email protected]
*Specification*
https://w3c.github.io/mathml-core/#layout-of-operators
*Summary*
Support for character-level and glyph-level mirroring when
rendering MathML operators in right-to-left mode. When using RTL
mode some operators can be mirrored by changing them to another
code point (e.g. a right parentheses becomes a left parentheses).
This is character-level mirroring, with equivalences defined by
Unicode's `Bidi_Mirrored` property. There are operators that have
no appropriate mirroring character. Glyph-level mirroring applies
in this case, with the `rtlm` font feature, where another glyph
can replace it in a mirrored context. Some existing
implementations mirror the original glyph directly, but this may
change the meaning for asymmetrical characters, such as the
clockwise contour integral.
*Blink component*
Blink>MathML
<https://issues.chromium.org/issues?q=customfield1222907:%22Blink%3EMathML%22>
*Web Feature ID*
mathml <https://webstatus.dev/features/mathml>
*TAG review*
None
*TAG review status*
Not applicable
*Risks*
*Interoperability and Compatibility*
None
/Gecko/:
Shipped/Shipping (https://bugzilla.mozilla.org/show_bug.cgi?id=945183)
Working
implementation shipping under the
`mathml.rtl_operator_mirroring.enabled` feature. Planning to send
an intent to ship.
/WebKit/: In development Already has character-level mirroring.
rtlm support is being worked on for the harfbuzz ports.
/Web developers/: No signals
/Other signals/:
*WebView application risks*
Does this intent deprecate or change behavior of existing APIs,
such that it has potentially high risk for Android WebView-based
applications?
None
*Goals for experimentation*
*Ongoing technical constraints*
None
*Debuggability*
None
*Will this feature be supported on all six Blink platforms
(Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?*
Yes
*Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>?*
Yes
New tests: - Character-level mirroring: checks that when switching
text direction the codepoints of the characters change to the
corresponding BidiMirrored equivalent (e.g. right to left
parentheses) - Glyph-level mirroring: checks that the rtlm font
feature is supported and that a specific glyph is used for certain
characters when switching text direction.
*Flag name on about://flags*
None
*Finch feature name*
MathMLOperatorRTLMirroring
*Requires code in //chrome?*
False
*Tracking bug*
https://issues.chromium.org/issues/40120782
*Estimated milestones*
DevTrial on desktop 140
DevTrial on Android 140
*Link to entry on the Chrome Platform Status*
https://chromestatus.com/feature/6317308531965952
*Links to previous Intent discussions*
Intent to Prototype:
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/686d2758.170a0220.a35ba.00d7.GAE%40google.com
This intent message was generated by Chrome Platform Status
<https://chromestatus.com>.
--
You received this message because you are subscribed to the Google
Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected].
To view this discussion visit
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/68ee55b8.050a0220.2a8282.0245.GAE%40google.com
<https://groups.google.com/a/chromium.org/d/msgid/blink-dev/68ee55b8.050a0220.2a8282.0245.GAE%40google.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google
Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To view this discussion visit
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CABc02_JdGb5qv3A3JEs0SCbkK7NtJ3F74HN1EeyODbavy9YkcQ%40mail.gmail.com
<https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CABc02_JdGb5qv3A3JEs0SCbkK7NtJ3F74HN1EeyODbavy9YkcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/fe9dd258-93dc-4104-baca-5cee655f393e%40igalia.com.