alexheretic / ab-glyph

Rust API for loading, scaling, positioning and rasterizing OpenType font glyphs
Apache License 2.0
372 stars 24 forks source link

index out of bounds: the len is 4 but the index is 5 #49

Closed Yatekii closed 1 year ago

Yatekii commented 3 years ago

I encounter this error:

thread 'main' panicked at 'index out of bounds: the len is 4 but the index is 5', /home/yatekii/.cargo/registry/src/github.com-1ecc6299db9ec823/ab_glyph_rasterizer-0.1.5/src/raster.rs:128:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

when running. I feel like this should not happen or if there are limitations, they should be outlined in the help text.

alexheretic commented 3 years ago

This looks like a bug, can you provide your font file / steps to reproduce?

Yatekii commented 3 years ago

Uff, that is happening incide iced. It happens when you insert a very high number (1 billion upwards I think) for the position of your text. It happens for every font I tried. Including the default one. I can upload the repo of my app lateron. I think maybe it's a conversion issue with large numbers, not sure.

alexheretic commented 3 years ago

Interesting could be a float issue then. We could probably avoid using the full position during rasterization, we only need the subpixel fractional offset :thinking:.

But I'll need to reproduce the panic itself & write a test case to properly fix the scenario.

alexheretic commented 3 years ago

If you could provide a short example iced app that panicked I should be able to trace the cause.

alexheretic commented 1 year ago

I'll close this as it was never reproduced, please reopen with repro steps