-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add support for character-level and glyph-level mirroring of RTL operators #277
base: main
Are you sure you want to change the base?
Conversation
spec.html
Outdated
<ul> | ||
<li> | ||
If <code>c</code> can be mirrored, then return | ||
the glyph corresponding to the result of mirroring <code>c</code>, and exit with success. [[BIDI]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please give us some references to the spec definition of "can be mirrored" and "mirroring"? That will help review this patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure -- in particular, it's this section of UAX9:
https://www.unicode.org/reports/tr9/#Mirroring
OpenType rtlm falls under HL6, I believe, so no check on Bidi_Mirrored is necessary:
https://www.unicode.org/reports/tr9/#HL6
The "corresponding codepoints" mentioned are given in Data9:
spec.html
Outdated
the glyph corresponding to the result of mirroring <code>c</code>, and exit with success. [[BIDI]] | ||
</li> | ||
<li> | ||
Otherwise, if there exists an OpenType rtlm variant of the input glyph, return that and exit with success. [[OPEN-FONT-FORMAT]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly for rtlm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spec.html
Outdated
Otherwise, if there exists an OpenType rtlm variant of the input glyph, return that and exit with success. [[OPEN-FONT-FORMAT]] | ||
</li> | ||
<li> | ||
Otherwise, return the input glyph and exit with success. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The algorithm is always successful... so I guess we don't need to specify "with success" here and elsewhere?
I think we indeed don't need to fail when a glyph is not mirrorable in RTL, we should just stretch the non-mirrored glyph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree, I've added this extra fallback step. I initially explicitly specified "with success" since I thought that this could fail if it wasn't possible to get any glyph for a codepoint (i.e. if the font didn't map one), but comparing this to the old version of the spec this should be fine(?).
7ed76b0
to
349f89b
Compare
I forgot to reference it, this is related to this issue: #67 |
Depends on #276.
Please see #67 and https://people.igalia.com/fwang/mathml-operator-mirroring-explainer.html.
This augments the various steps that get the glyph for the character in the "layout of operators" algorithm to additionally mirror the character/glyph in RTL writing modes, using Unicode's BIDI or OpenType's rtlm respectively.