notofonts / tamil

Noto Tamil
SIL Open Font License 1.1
4 stars 0 forks source link

Kerning exceptions apply incorrectly, causing clashes (workaround required) #15

Closed Hoolean closed 1 year ago

Hoolean commented 1 year ago

Hello!

When testing ufo2ft across the Noto Fonts project we identified ufo2ft#706, which causes base-base kerning exceptions to apply incorrectly to kerning pairs that use groups containing marks.

We are making some noise here in case you wish to fix the issue in any releases you make before the bug is resolved upstream.

Reproducing

e.g. in sources

$ kerning-validator NotoSerifTamil-BoldItalic.ufo

script='Taml' direction='LTR': aa-tamil ha-tamil should be -60 but is -160
script='Taml' direction='LTR': aa-tamil lu-tamil should be -50 but is -150
script='Taml' direction='LTR': aa-tamil luu-tamil should be -50 but is -150
script='Taml' direction='LTR': aa-tamil nnnu-tamil should be -50 but is -150
script='Taml' direction='LTR': aa-tamil nnu-tamil should be -50 but is -150
script='Taml' direction='LTR': aa-tamil nnuu-tamil should be -50 but is -150
script='Taml' direction='LTR': cuu-tamil ha-tamil should be -60 but is -160
script='Taml' direction='LTR': cuu-tamil lu-tamil should be -50 but is -150
script='Taml' direction='LTR': cuu-tamil luu-tamil should be -50 but is -150
script='Taml' direction='LTR': cuu-tamil nnnu-tamil should be -50 but is -150
script='Taml' direction='LTR': cuu-tamil nnu-tamil should be -50 but is -150
script='Taml' direction='LTR': cuu-tamil nnuu-tamil should be -50 but is -150
script='Taml' direction='LTR': nguu-tamil ha-tamil should be -60 but is -160
script='Taml' direction='LTR': nguu-tamil lu-tamil should be -50 but is -150
script='Taml' direction='LTR': nguu-tamil luu-tamil should be -50 but is -150
script='Taml' direction='LTR': nguu-tamil nnnu-tamil should be -50 but is -150
script='Taml' direction='LTR': nguu-tamil nnu-tamil should be -50 but is -150
script='Taml' direction='LTR': nguu-tamil nnuu-tamil should be -50 but is -150
script='Taml' direction='LTR': onethousand-tamil ha-tamil should be -60 but is -160
script='Taml' direction='LTR': onethousand-tamil lu-tamil should be -50 but is -150
script='Taml' direction='LTR': onethousand-tamil luu-tamil should be -50 but is -150
script='Taml' direction='LTR': onethousand-tamil nnnu-tamil should be -50 but is -150
script='Taml' direction='LTR': onethousand-tamil nnu-tamil should be -50 but is -150
script='Taml' direction='LTR': onethousand-tamil nnuu-tamil should be -50 but is -150
script='Taml' direction='LTR': puu-tamil ha-tamil should be -60 but is -160
script='Taml' direction='LTR': puu-tamil lu-tamil should be -50 but is -150
script='Taml' direction='LTR': puu-tamil luu-tamil should be -50 but is -150
script='Taml' direction='LTR': puu-tamil nnnu-tamil should be -50 but is -150
script='Taml' direction='LTR': puu-tamil nnu-tamil should be -50 but is -150
script='Taml' direction='LTR': puu-tamil nnuu-tamil should be -50 but is -150
script='Taml' direction='LTR': vuu-tamil ha-tamil should be -60 but is -160
script='Taml' direction='LTR': vuu-tamil lu-tamil should be -50 but is -150
script='Taml' direction='LTR': vuu-tamil luu-tamil should be -50 but is -150
script='Taml' direction='LTR': vuu-tamil nnnu-tamil should be -50 but is -150
script='Taml' direction='LTR': vuu-tamil nnu-tamil should be -50 but is -150
script='Taml' direction='LTR': vuu-tamil nnuu-tamil should be -50 but is -150
script='Taml' direction='LTR': yuu-tamil ha-tamil should be -60 but is -160
script='Taml' direction='LTR': yuu-tamil lu-tamil should be -50 but is -150
script='Taml' direction='LTR': yuu-tamil luu-tamil should be -50 but is -150
script='Taml' direction='LTR': yuu-tamil nnnu-tamil should be -50 but is -150
script='Taml' direction='LTR': yuu-tamil nnu-tamil should be -50 but is -150
script='Taml' direction='LTR': yuu-tamil nnuu-tamil should be -50 but is -150

Note: this is a partial list; the affected pairs vary by UFO, which has been omitted for brevity.

e.g. in production fonts

Example pair: ௲லு should be kerned in googlefonts/ttf/NotoSerifTamil-Regular.ttf from the latest release but is not.

Workaround

  1. Run kerning-validator on each source UFO, as shown in the example above
  2. If issues are reported, split the affected groups into one containing only bases and one containing only marks to resolve
Hoolean commented 1 year ago

Found a more severe production example; this issue causes ஆலூ to clash in Noto Serif Black Italic: ஆலூ shown clashing in the Google Fonts type tester

simoncozens commented 1 year ago

Thank you, that's helpful! When I try this with the new kern writer in ufo2ft, I hit https://github.com/googlefonts/ufo2ft/issues/702, so there are clearly some assumptions we are making about base/base base/mark kerning that are incorrect.

Hoolean commented 1 year ago

Indeedy, kerning-validator won't be happy testing with ufo2ft's main until googlefonts/ufo2ft#705 is merged, although taking a peek we found that the bug has been wily enough to survive the refactor for script-based splitting 👹

We are going to have to introduce an additional split on pairs to break them into statements that only match contexts with no marks (for the base lookup) and that only match contexts with at least one mark (for the marks lookup), which should resolve this and a few other corner cases, and is the automatic equivalent of the current manual workaround : )

simoncozens commented 1 year ago

OK, so if I build with ufo2ft@a8c489d, it builds but kerning doesn't work. But joyously, ufo2ft@29b7ca5 fixes kerning: shape