Open dscorbett opened 5 years ago
per MT fixed
This issue should be reopened.
I see that you’ve added a new glyph, uni2272.mir, to the font. That has no effect and does not address this bug. The shaper replaces uni2272 with uni2273 because U+2272 appears in the OMPL. 'rtlm' is not applied and uni2272.mir is unused. To override the OMPL, use 'rtla' instead.
Another problem is that this attempted fix only applies to U+2272. That was just one example. There are plenty of other characters with best-fit mirrorings.
'rtlm' is not applied and uni2272.mir is unused. To override the OMPL, use 'rtla' instead.
(I was told this was fixed in the latest version, but it's not.) I tried using rtla
, but it makes no difference; Harfbuzz still does the mirroring itself. Indeed, it looks like the mirroring happens before we hit GSUB:
$ shape -V master_ttf/NotoSansMath-Regular.ttf -u 2272 --direction=rtl
trace: start table GSUB buffer: [greaterorequivalent=0]
But I'm confused. I would then expect Harfbuzz to then do something in rtla, presumably to substitute it for greaterorequivalent.rtlm
, but nothing happens:
trace: start lookup 6 feature 'rtla' buffer: [greaterorequivalent=0]
trace: end lookup 6 feature 'rtla' buffer: [greaterorequivalent=0]
(Maybe because the mirroring happens already?)
If that's the case, then I'm not sure this is something we can fix in the font.
All you need to do is add a mapping in 'rtla' from uni2273
to uni2272.rtlm
. Other mirroring pairs can be fixed similarly.
I tried using
rtla
, but it makes no difference; Harfbuzz still does the mirroring itself. Indeed, it looks like the mirroring happens before we hit GSUB
Exactly. 'rtla' doesn’t replace HarfBuzz’s default mirroring: it supplements it, by being applied in a later step.
I would then expect Harfbuzz to then do something in rtla, presumably to substitute it for
greaterorequivalent.rtlm
, but nothing happens
Nothing happens because this font’s 'rtla' lookup has no rule for uni2273
.
I’m questioning many of the best fit and entries without encoded mirrors in BidiMirroring.txt. I’m checking Arabic math book and slashes/solidi/etc, or tildes are not mirrored, unlike other symbols. So I think the file needs to be checked against actual usage of these symbols, and feedback should be submitted to Unicode to revise this file.
Font
NotoSansMath-Regular.ttf
Where the font came from, and when
Site: https://github.com/googlei18n/noto-fonts/blob/c30307083469f0c05e216ac75216fd454a517858/hinted/NotoSansMath-Regular.ttf Date: 2019-02-04
Font version
Version 2.000
Issue
Characters whose bidi-mirrored glyphs are marked [BEST FIT] in BidiMirroring.txt are mirrored to their best fits, but it would be better to mirror them fully. For example, U+2272 LESS-THAN OR EQUIVALENT TO has a Bidi_Mirroring_Glyph of U+2273 GREATER-THAN OR EQUIVALENT TO, so the shaper replaces U+2272 with U+2273 in RTL text. However, this is just a best fit because, ideally, the tilde part of the glyph would be mirrored too.
According to the OpenType spec, this would only be true for characters in the OpenType Mirroring Pairs List, but HarfBuzz by default uses the full latest list from Unicode (harfbuzz/harfbuzz#492). That means that, for example, HarfBuzz mirrors uni2A85 to uni2A86, bypassing the intended uni2A85.aalt.
Character data
≲⪅ U+2272 LESS-THAN OR EQUIVALENT TO U+2A85 LESS-THAN OR APPROXIMATE
Screenshot
Left-to-right: Right-to-left in HarfBuzz: Right-to-left in HarfBuzz modified to use the OMPL: