Closed golddranks closed 6 years ago
Hmmm, https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-4-segment-mapping-to-delta-values doesn't say anything about rounding up, and integer division usually truncates.
What font and code point are you testing with?
Oops, now there is a case where 1 divided by 2 doesn't go to 0 so the loop never terminaties. Fixing that.
I'm using https://fonts.google.com/specimen/Kosugi+Maru and the code point it fails with is 赤, U+8d64.
https://github.com/raphlinus/font-rs/pull/34 fixes this with more robust and easily-understandable logic so I'm closing this.
An attempt to fix the bug described here: https://github.com/raphlinus/font-rs/issues/32
Additionally, found a corner case where it underflows when the code point searched for is smaller than any of the code points supported by the font.