Closed maxmelander closed 4 months ago
What text are you shaping?
I tried this for example and can't really reproduce it: cargo run --example shape /System/Library/Fonts/Supplemental/Malayalam\ MN.ttc "മലയാളം"
In this example, "abc". But seems to fail with any string. Just tested with "ഹലോ" as well with the same result.
Okay, thanks for trying it out. I will try to investigate a bit further and see if I can pinpoint where the problem is coming from.
Yeah, that would help. 👍 I can't reproduce it at all, unfortunately.
@LaurenzV Perhaps this is because WASM is 32bit?
Looks like one of the len
s passed to ttf_parser::Stream::read_bytes
is 4294967283.
While overflowing isn't great (shouldn't panic in release mode?), I bet we're reading something wrong in the first place.
Looks like one of kerx
subtable's length is set to 4294967283, aka 0xFFFFFFF3, which is very suspicious.
Maybe it's meant to be a signed integer?
What a dumb mistake... An iterator was going forever. No idea how it wasn't affecting current tests. Maybe all kerx
tables we had so far had just one table, which kinda solves the issue, afaik.
When trying to shape with the MacOS fonts "Malayalam MN" or "Malayalam Sangam MN", the ttf-parser panics with:
panicked at tf-parser-cef4d149453e6ac0/85c1ff2/src/parser.rs:767:44:attempt to add with overflow
The stack trace is something like:
This is tested with our own fork of cosmic-text, using the latest commit of rustybuzz, running in a wasm context. The font is loaded with the Local Font Access API