RazrFalcon / rustybuzz

A complete harfbuzz's shaping algorithm port to Rust
MIT License
544 stars 34 forks source link

How to check what is the minimum reshaping range when inserting a glyph? #54

Closed wdanilo closed 2 years ago

wdanilo commented 2 years ago

Hi, I know that GlyphInfo::unsafe_to_break exists, but I think it does not cover my use case. I want to redraw only part of a long line of text after inserting a glyph. I want to know what part of the text should be redrawn. Let's consider the input அட0. If I insert after , then I should get ட் instead of , but I do not need to redraw neither nor 0. Is there any utility in Rustybuzz to discover it? If not, do you have any hints on how this can be done?

RazrFalcon commented 2 years ago

I never had such a task so no idea. And there is nothing rustybuzz to simplify this.

wdanilo commented 2 years ago

Gotcha! In such a case, I'm closing this topic here. Thanks for your help!

RazrFalcon commented 2 years ago

I would suggest asking in https://github.com/harfbuzz/harfbuzz directly and then adopting the solution to rustybuzz. After all, the API is mostly the same.

behdad commented 2 years ago

We have a newer glyph flag in HarfBuzz that can be used for this purpose, almost... It's called unsafe-to-concat. It's tricky to use though.

https://harfbuzz.github.io/harfbuzz-hb-buffer.html#HB-GLYPH-FLAG-UNSAFE-TO-CONCAT:CAPS