Ready for Developer Testing: Mirroring of RTL MathML operators

101 views
Skip to first unread message

Chromestatus

unread,
Oct 14, 2025, 9:53:10 AMOct 14
to blin...@chromium.org, e...@igalia.com, fw...@igalia.com
Contact emails
e...@igalia.com, fw...@igalia.com

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

Web Feature ID
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?
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 desktop140
DevTrial on Android140


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.

PhistucK

unread,
Oct 18, 2025, 1:52:02 PMOct 18
to Chromestatus, blin...@chromium.org, e...@igalia.com, fw...@igalia.com
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?
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?


PhistucK


--
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 blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/68ee55b8.050a0220.2a8282.0245.GAE%40google.com.

Frédéric Wang

unread,
Oct 20, 2025, 3:15:28 AMOct 20
to blin...@chromium.org

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

rtl-math.html
rtl-math-chrome-canary-experimental-web-platform-features-disabled.png
rtl-math-chrome-canary-experimental-web-platform-features-enabled.png

PhistucK

unread,
Oct 20, 2025, 9:50:35 AMOct 20
to Frédéric Wang, blin...@chromium.org
I see - thank you very much for the explanation and test cases! Sounds good to me. :)


PhistucK


Reply all
Reply to author
Forward
0 new messages