Skip to content
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

[AAT] Shaping seems to break down eventually in a long string #1531

Closed
jfkthame opened this issue Jan 2, 2019 · 2 comments
Closed

[AAT] Shaping seems to break down eventually in a long string #1531

jfkthame opened this issue Jan 2, 2019 · 2 comments
Labels
aat Apple Advanced Typography

Comments

@jfkthame
Copy link
Collaborator

jfkthame commented Jan 2, 2019

Looking at Tibetan example, using Kailasa.ttc from macOS 10.13.6, I noticed shaping failure a long way in to this string:

དགོས་མཁོ་སྒྲུབ་པའི་རང་དབང་བཅས་ལ་ལོངས་སུ་སྤྱད་ཆོག་པའི་འཛམ་གླིང་ཞིག་འབྱུང་ཐབས་དེ་ནི་སྤྱིར་བཏང་མི་མང་ཡོངས་ཀྱི་རེ་འདོད་ཆེ་ཤོས་ཤིག་ཏུ་ངེས་པ་རྒྱ་ཁྱབ་ཡོངས་སུ་གྲགས་པ་ཡིན།

(That's U+0F51,U+0F42,U+0F7C,U+0F66,U+0F0B,U+0F58,U+0F41,U+0F7C,U+0F0B,U+0F66,U+0F92,U+0FB2,U+0F74,U+0F56,U+0F0B,U+0F54,U+0F60,U+0F72,U+0F0B,U+0F62,U+0F44,U+0F0B,U+0F51,U+0F56,U+0F44,U+0F0B,U+0F56,U+0F45,U+0F66,U+0F0B,U+0F63,U+0F0B,U+0F63,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F66,U+0F74,U+0F0B,U+0F66,U+0FA4,U+0FB1,U+0F51,U+0F0B,U+0F46,U+0F7C,U+0F42,U+0F0B,U+0F54,U+0F60,U+0F72,U+0F0B,U+0F60,U+0F5B,U+0F58,U+0F0B,U+0F42,U+0FB3,U+0F72,U+0F44,U+0F0B,U+0F5E,U+0F72,U+0F42,U+0F0B,U+0F60,U+0F56,U+0FB1,U+0F74,U+0F44,U+0F0B,U+0F50,U+0F56,U+0F66,U+0F0B,U+0F51,U+0F7A,U+0F0B,U+0F53,U+0F72,U+0F0B,U+0F66,U+0FA4,U+0FB1,U+0F72,U+0F62,U+0F0B,U+0F56,U+0F4F,U+0F44,U+0F0B,U+0F58,U+0F72,U+0F0B,U+0F58,U+0F44,U+0F0B,U+0F61,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F40,U+0FB1,U+0F72,U+0F0B,U+0F62,U+0F7A,U+0F0B,U+0F60,U+0F51,U+0F7C,U+0F51,U+0F0B,U+0F46,U+0F7A,U+0F0B,U+0F64,U+0F7C,U+0F66,U+0F0B,U+0F64,U+0F72,U+0F42,U+0F0B,U+0F4F,U+0F74,U+0F0B,U+0F44,U+0F7A,U+0F66,U+0F0B,U+0F54,U+0F0B,U+0F62,U+0F92,U+0FB1,U+0F0B,U+0F41,U+0FB1,U+0F56,U+0F0B,U+0F61,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F66,U+0F74,U+0F0B,U+0F42,U+0FB2,U+0F42,U+0F66,U+0F0B,U+0F54,U+0F0B,U+0F61,U+0F72,U+0F53,U+0F0D)

Result with --shaper coretext:

[d.=0+1229|g.=1+1343|_.o=1+0|s.=3+1343|Tsheg.=4+414|m.=5+1343|kh.=6+1342|_.o=6+0|Tsheg.=8+415|s_g_r_u=9+1319|b.=13+1342|Tsheg.=14+415|p.=15+1342|a.=16+1228|_.i=16+0|Tsheg.=18+415|r.=19+1274|ng.=20+1229|Tsheg.=21+414|d.=22+1229|b.=23+1343|ng.=24+1229|Tsheg.=25+414|b.=26+1343|c.=27+1389|s.=28+1343|Tsheg.=29+414|l.=30+1389|Tsheg.=31+414|l.=32+1389|_.o=32+0|ng.=34+1229|s.=35+1343|Tsheg.=36+415|s_u=37+1343|Tsheg.=39+415|s_p_y=40+1319|d.=43+1229|Tsheg.=44+415|ch.=45+1343|_.o=45+0|g.=47+1343|Tsheg.=48+415|p.=49+1343|a.=50+1229|_.i=50+0|Tsheg.=52+415|a.=53+1229|dz.=54+1229|m.=55+1343|Tsheg.=56+415|g_l=57+1343|_.i=57+0|ng.=60+1229|Tsheg.=61+415|zh.=62+1229|_.i=62+0|g.=64+1343|Tsheg.=65+415|a.=66+1229|b_y_u=67+1319|ng.=70+1228|Tsheg.=71+414|th.=72+1229|b.=73+1342|s.=74+1342|Tsheg.=75+414|d.=76+1229|_.e=76+0|Tsheg.=78+414|n.=79+1229|_.i=79+0|Tsheg.=81+414|s_p_y=82+1318|_.i=82+0|r.=86+1273|Tsheg.=87+414|b.=88+1342|t.=89+1229|ng.=90+1229|Tsheg.=91+414|m.=92+1342|_.i=92+0|Tsheg.=94+414|m.=95+1342|ng.=96+1229|Tsheg.=97+414|y.=98+1456|_.o=98+0|ng.=100+1229|s.=101+1342|Tsheg.=102+414|k_y=103+1318|_.i=103+0|Tsheg.=106+414|r.=107+1273|_.e=107+0|Tsheg.=109+414|a.=110+1229|d.=111+1229|_.o=111+0|d.=113+1229|Tsheg.=114+414|ch.=115+1342|_.e=115+0|Tsheg.=117+214|sh.=118+1342|_.o=118+0|s.=120+1342|Tsheg.=121+214|sh.=122+1342|_.i=122+0|g.=124+1342|Tsheg.=125+414|t_u=126+1229|Tsheg.=128+414|ng.=129+1229|_.e=129+0|s.=131+1342|Tsheg.=132+414|p.=133+1342|Tsheg.=134+414|r_g_y=135+1318|Tsheg.=138+414|kh_y=139+1342|b.=141+1342|Tsheg.=142+414|y.=143+1456|_.o=143+0|ng.=145+1229|s.=146+1342|Tsheg.=147+414|s_u=148+1342|Tsheg.=150+414|g_r=151+1342|g.=153+1342|s.=154+1342|Tsheg.=155+414|p.=156+1342|Tsheg.=157+414|y.=158+1456|_.i=158+0|n.=160+1228|Shad.=161+636]

And with --shaper ot:

[d.=0+1229|g.=1+1343|_.o=1+0|s.=3+1343|Tsheg.=4+415|m.=5+1343|kh.=6+1343|_.o=6+0|Tsheg.=8+415|s_g_r_u=9+1319|b.=13+1343|Tsheg.=14+415|p.=15+1343|a.=16+1229|_.i=16+0|Tsheg.=18+415|r.=19+1274|ng.=20+1229|Tsheg.=21+415|d.=22+1229|b.=23+1343|ng.=24+1229|Tsheg.=25+415|b.=26+1343|c.=27+1389|s.=28+1343|Tsheg.=29+415|l.=30+1389|Tsheg.=31+415|l.=32+1389|_.o=32+0|ng.=34+1229|s.=35+1343|Tsheg.=36+415|s_u=37+1343|Tsheg.=39+415|s_p_y=40+1319|d.=43+1229|Tsheg.=44+415|ch.=45+1343|_.o=45+0|g.=47+1343|Tsheg.=48+415|p.=49+1343|a.=50+1229|_.i=50+0|Tsheg.=52+415|a.=53+1229|dz.=54+1229|m.=55+1343|Tsheg.=56+415|g_l=57+1343|_.i=57+0|ng.=60+1229|Tsheg.=61+415|zh.=62+1229|_.i=62+0|g.=64+1343|Tsheg.=65+415|a.=66+1229|b_y_u=67+1319|ng.=70+1229|Tsheg.=71+415|th.=72+1229|b.=73+1343|s.=74+1343|Tsheg.=75+415|d.=76+1229|_.e=76+0|Tsheg.=78+415|n.=79+1229|_.i=79+0|Tsheg.=81+415|s_p_y=82+1319|_.i=82+0|r.=86+1274|Tsheg.=87+415|b.=88+1343|t.=89+1229|ng.=90+1229|Tsheg.=91+415|m.=92+1343|_.i=92+0|Tsheg.=94+415|m.=95+1343|ng.=96+1229|Tsheg.=97+415|y.=98+1456|_.o=98+0|ng.=100+1229|s.=101+1343|Tsheg.=102+415|k_y=103+1319|_.i=103+0|Tsheg.=106+415|r.=107+1274|_.e=107+0|Tsheg.=109+415|a.=110+1229|d.=111+1229|_.o=111+0|d.=113+1229|Tsheg.=114+415|ch.=115+1343|_.e=115+0|Tsheg.=117+415|sh.=118+1343|_.o=118+0|s.=120+1343|Tsheg.=121+415|sh.=122+1343|_.i=122+0|g.=124+1343|Tsheg.=125+415|t.=126+1229|_u=126@-1436,0+0|Tsheg.=128+415|ng.=129+1229|_.e=129+0|s.=131+1343|Tsheg.=132+415|p.=133+1343|Tsheg.=134+415|r.=135+1274|_g=135@-1319,0+0|_y=135@-1319,0+0|Tsheg.=138+415|kh.=139+1343|_y=139@-1319,0+0|b.=141+1343|Tsheg.=142+415|y.=143+1456|_.o=143+0|ng.=145+1229|s.=146+1343|Tsheg.=147+415|s.=148+1343|_u=148@-1436,0+0|Tsheg.=150+415|g.=151+1343|_r=151@-1319,0+0|g.=153+1343|s.=154+1343|Tsheg.=155+415|p.=156+1343|Tsheg.=157+415|y.=158+1456|_.i=158+0|n.=160+1229|Shad.=161+637]

The first error I noticed occurs at cluster 126, where CoreText has t_u=126+1229, but OT gives t.=126+1229|_u=126@-1436,0+0. It seems like shaping has broken down at that point; shortly thereafter, we have CoreText r_g_y=135+1318 but OT r.=135+1274|_g=135@-1319,0+0|_y=135@-1319,0+0.

If I try to isolate just the "broken" sequences, they shape fine with --shaper ot; the problem seems to depend on the long context here.

@ebraminio
Copy link
Collaborator

10.13.6:

hb-view --font-file "/Library/Fonts/Kailasa.ttc" --unicodes U+0F51,U+0F42,U+0F7C,U+0F66,U+0F0B,U+0F58,U+0F41,U+0F7C,U+0F0B,U+0F66,U+0F92,U+0FB2,U+0F74,U+0F56,U+0F0B,U+0F54,U+0F60,U+0F72,U+0F0B,U+0F62,U+0F44,U+0F0B,U+0F51,U+0F56,U+0F44,U+0F0B,U+0F56,U+0F45,U+0F66,U+0F0B,U+0F63,U+0F0B,U+0F63,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F66,U+0F74,U+0F0B,U+0F66,U+0FA4,U+0FB1,U+0F51,U+0F0B,U+0F46,U+0F7C,U+0F42,U+0F0B,U+0F54,U+0F60,U+0F72,U+0F0B,U+0F60,U+0F5B,U+0F58,U+0F0B,U+0F42,U+0FB3,U+0F72,U+0F44,U+0F0B,U+0F5E,U+0F72,U+0F42,U+0F0B,U+0F60,U+0F56,U+0FB1,U+0F74,U+0F44,U+0F0B,U+0F50,U+0F56,U+0F66,U+0F0B,U+0F51,U+0F7A,U+0F0B,U+0F53,U+0F72,U+0F0B,U+0F66,U+0FA4,U+0FB1,U+0F72,U+0F62,U+0F0B,U+0F56,U+0F4F,U+0F44,U+0F0B,U+0F58,U+0F72,U+0F0B,U+0F58,U+0F44,U+0F0B,U+0F61,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F40,U+0FB1,U+0F72,U+0F0B,U+0F62,U+0F7A,U+0F0B,U+0F60,U+0F51,U+0F7C,U+0F51,U+0F0B,U+0F46,U+0F7A,U+0F0B,U+0F64,U+0F7C,U+0F66,U+0F0B,U+0F64,U+0F72,U+0F42,U+0F0B,U+0F4F,U+0F74,U+0F0B,U+0F44,U+0F7A,U+0F66,U+0F0B,U+0F54,U+0F0B,U+0F62,U+0F92,U+0FB1,U+0F0B,U+0F41,U+0FB1,U+0F56,U+0F0B,U+0F61,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F66,U+0F74,U+0F0B,U+0F42,U+0FB2,U+0F42,U+0F66,U+0F0B,U+0F54,U+0F0B,U+0F61,U+0F72,U+0F53,U+0F0D --shaper coretext

image

hb-view --font-file "/Library/Fonts/Kailasa.ttc" --unicodes U+0F51,U+0F42,U+0F7C,U+0F66,U+0F0B,U+0F58,U+0F41,U+0F7C,U+0F0B,U+0F66,U+0F92,U+0FB2,U+0F74,U+0F56,U+0F0B,U+0F54,U+0F60,U+0F72,U+0F0B,U+0F62,U+0F44,U+0F0B,U+0F51,U+0F56,U+0F44,U+0F0B,U+0F56,U+0F45,U+0F66,U+0F0B,U+0F63,U+0F0B,U+0F63,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F66,U+0F74,U+0F0B,U+0F66,U+0FA4,U+0FB1,U+0F51,U+0F0B,U+0F46,U+0F7C,U+0F42,U+0F0B,U+0F54,U+0F60,U+0F72,U+0F0B,U+0F60,U+0F5B,U+0F58,U+0F0B,U+0F42,U+0FB3,U+0F72,U+0F44,U+0F0B,U+0F5E,U+0F72,U+0F42,U+0F0B,U+0F60,U+0F56,U+0FB1,U+0F74,U+0F44,U+0F0B,U+0F50,U+0F56,U+0F66,U+0F0B,U+0F51,U+0F7A,U+0F0B,U+0F53,U+0F72,U+0F0B,U+0F66,U+0FA4,U+0FB1,U+0F72,U+0F62,U+0F0B,U+0F56,U+0F4F,U+0F44,U+0F0B,U+0F58,U+0F72,U+0F0B,U+0F58,U+0F44,U+0F0B,U+0F61,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F40,U+0FB1,U+0F72,U+0F0B,U+0F62,U+0F7A,U+0F0B,U+0F60,U+0F51,U+0F7C,U+0F51,U+0F0B,U+0F46,U+0F7A,U+0F0B,U+0F64,U+0F7C,U+0F66,U+0F0B,U+0F64,U+0F72,U+0F42,U+0F0B,U+0F4F,U+0F74,U+0F0B,U+0F44,U+0F7A,U+0F66,U+0F0B,U+0F54,U+0F0B,U+0F62,U+0F92,U+0FB1,U+0F0B,U+0F41,U+0FB1,U+0F56,U+0F0B,U+0F61,U+0F7C,U+0F44,U+0F66,U+0F0B,U+0F66,U+0F74,U+0F0B,U+0F42,U+0FB2,U+0F42,U+0F66,U+0F0B,U+0F54,U+0F0B,U+0F61,U+0F72,U+0F53,U+0F0D --shaper ot

image

@ebraminio ebraminio added the aat Apple Advanced Typography label Jan 3, 2019
@behdad behdad closed this as completed in b976940 Jan 24, 2019
@behdad
Copy link
Member

behdad commented Jan 24, 2019

So what was happening was that the ligature stack was getting full and after that we refused any processing. The change I already pushed just resets the stack in that case. Proper fix is to make the stack a ring buffer. Reopening to do that.

@behdad behdad reopened this Jan 24, 2019
@behdad behdad closed this as completed in a371a28 Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aat Apple Advanced Typography
Projects
None yet
Development

No branches or pull requests

3 participants