Open Bug 1077525 Opened 5 years ago Updated Last month

vertical writing mode support for MathML

Categories

(Core :: MathML, defect)

defect
Not set

Tracking

()

People

(Reporter: jfkthame, Unassigned)

References

(Depends on 2 open bugs, Blocks 3 open bugs)

Details

Attachments

(5 files)

It's unclear to me whether there is a need for vertical MathML; if so, a bunch of MathML layout code will need to be logicalized. If not, we may want to explicitly impose horizontal-tb writing mode on all MathML content.
Blocks: 1079125
Depends on: 1095933
May be, there is no need for vertical MathML in CJK, but in Mongolian need for it.
Attached image image1.JPG
Attached image image2.JPG
Attached image image3.JPG
Attached image image5.JPG
(In reply to siqinbilige from comment #1)
> May be, there is no need for vertical MathML in CJK, but in Mongolian need
> for it.

Thank you for these helpful examples. That indeed seems an important use case to handle.

I'm not really familiar with the writing-mode property. But for the CSS direction our MathML user agent stylesheet sets it to left-to-right (so that it works for LTR languages as well as RTL languages/countries embedding LRT math) but that can be overridden to use right-to-left math too. I wonder if something similar should be done for MathML i.e. keep the writing-mode: horizontal-tb rule added in bug 1095933 but remove !important so that one can explicitly override it. Or should we instead inherit the writing-mode?
We should probably inherit the writing-mode -- bug 1095933 is a stopgap measure just to avoid total chaos! -- so that math within a vertical-writing context behaves sensibly by default, but we can only do that once the MathML frames have been adapted to handle it -- which I think means performing exactly the same math layout as they would in horizontal mode, but rendering with a 90° rotation. (Like a "sideways" mode rather than an "upright vertical" mode; I don't think there's any use case for the latter -- or any real idea what it would look like.)

I guess this could almost be done by simply forcing the writing-mode to horizontal and then applying a CSS transform to rotate the result, but the problem with this is that transforms only affect rendering, they don't affect the element's metrics for layout purposes.
(In reply to Jonathan Kew (:jfkthame) from comment #7)
> We should probably inherit the writing-mode -- bug 1095933 is a stopgap
> measure just to avoid total chaos! -- so that math within a vertical-writing
> context behaves sensibly by default, but we can only do that once the MathML
> frames have been adapted to handle it -- which I think means performing
> exactly the same math layout as they would in horizontal mode, but rendering
> with a 90° rotation. (Like a "sideways" mode rather than an "upright
> vertical" mode; I don't think there's any use case for the latter -- or any
> real idea what it would look like.)
> 
> I guess this could almost be done by simply forcing the writing-mode to
> horizontal and then applying a CSS transform to rotate the result, but the
> problem with this is that transforms only affect rendering, they don't
> affect the element's metrics for layout purposes.

Yes, of course amending the code to fix the layout metrics will more tedious part than just the user stylesheet change :-)

Indeed, I don't think there could be a "upright vertical" math mode, however it's possible that one embed some vertical text in an <mtext> element (or even more complex HTML) and in that case just applying a rotation to the whole formula won't work...

I'm cc'ing Xuan who wrote https://developer.mozilla.org/zh-CN/docs/Mozilla_MathML_Project/Start, maybe he can give more feedback.
(In reply to Frédéric Wang (:fredw) from comment #8)
> I'm cc'ing Xuan who wrote
> https://developer.mozilla.org/zh-CN/docs/Mozilla_MathML_Project/Start, maybe
> he can give more feedback.

To my knowledge, vertical math mode is really rare in Chinese.
Actually, I have never seen any Chinese documents with math in vertical mode.
Attached file testcase
I am definitely in favour of supporting MathML for vertical-writing CJK.

My use case needs this.
I think it's reasonable to fix bug 1492931 before fixing this bug.
Depends on: 1492931

(In reply to 張俊芝(Zhang Junzhi) from comment #12)

I think it's reasonable to fix bug 1492931 before fixing this bug.

I'm not sure it's going to be the easiest path as there are a lot of things to change. As Jonathan said, we can already take writing-mode into account in the MathML layout code and "logicalized" the layout.

(In reply to 張俊芝(Zhang Junzhi) from comment #11)

I am definitely in favour of supporting MathML for vertical-writing CJK.

My use case needs this.

Out of curiosity, are you able to share what it is? So far I'm only aware of siqinbilige's Mongolian use case (comment 1). Do you know if vertical math is used with other CJK languages? Do you have examples (e.g. screenshots of books). Thanks.

(In reply to Frédéric Wang (:fredw) from comment #13)

(In reply to 張俊芝(Zhang Junzhi) from comment #11)

I am definitely in favour of supporting MathML for vertical-writing CJK.

My use case needs this.

Out of curiosity, are you able to share what it is? So far I'm only aware of siqinbilige's Mongolian use case (comment 1). Do you know if vertical math is used with other CJK languages? Do you have examples (e.g. screenshots of books). Thanks.

I've been writing writing-mode responsive pages for years, and recently I also started writing user-content-generated pages which may contain Math expressions. So since two features get together on those pages, that means, though I am not sure if the users will possibly encounter a Math expression when viewing vertical-writing pages in real case, those pages at least technically speaking should support vertical MathML.

(In reply to Frédéric Wang (:fredw) from comment #13)

(In reply to 張俊芝(Zhang Junzhi) from comment #12)

I think it's reasonable to fix bug 1492931 before fixing this bug.

I'm not sure it's going to be the easiest path as there are a lot of things to change. As Jonathan said, we can already take writing-mode into account in the MathML layout code and "logicalized" the layout.

(In reply to 張俊芝(Zhang Junzhi) from comment #11)

I am definitely in favour of supporting MathML for vertical-writing CJK.

My use case needs this.

Do you know if vertical math is used with other CJK languages? Do you have examples (e.g. screenshots of books). Thanks.

Right now, I haven't seen other real-world examples, except mine.

Depends on: 1586574
You need to log in before you can comment on or make changes to this bug.