-
Notifications
You must be signed in to change notification settings - Fork 624
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
Safe-to-break API #224
Comments
Not all shapers code is updated to set this properly. GSUB and Arabic shaper are updated. GPOS and other shapers are NOT. Fixes #224
Work-in-progress branch here: https://github.com/behdad/harfbuzz/commits/wip-unsafe-to-break |
Sample run:
|
Thanks Behdad, I’ll have a look. I’m just wondering, does this help with breaking inside ligatures anyhow? I assume it will be a unsafe-to-break place, but then I’ll just need to reshape, no other shortcut? I’ve been trying to address breaking inside ligatures in Scribus (HOST-Oman/scribus#144) and all we did so far is to just disallow line breaking there. |
Yeah, breaking inside a cluster needs reshape. Breaking inside a Unicode grapheme also needs reshape. This API identifies additional places that need a reshape. |
any updates on this? if this doesn't work what is everyone using for linebreaking currently then |
Hi Behdad, do you expend to get back to working at this in the near term? Anything I can do to help? We'd like to start using this for line breaking in Blink. |
Yes, I like to. Wasn't high-priority. Will try to have something testable this quarter. |
Reopening, to fix GPOS, and non-Arabic complex shapers. |
Fixed all: Not tested. Adding a verification step to test suite and possibly hb-shape to verify safe-to-break points. |
I’m wondering, can this flag be used for letter-spacing as well as it seems to handle cursive and mark attachment, or do one still need to check Unicode grapheme clusters boundaries? |
I have another message in my drafts folder for exposing Arabic and cursive joining. This flag is much more broad. A long chain-context match marks the entire match range as unsafe-to-break. |
Thanks so much Behdad, looks great and works like a charm! One small suggestion: union { |
Great to hear!
Previously mask was unused publicly. The fact that hb_mask_t was even exposed is a mistake in retrospect. So I'm fine trying to repurpose it to the extent possible.
Humm. The question would be whether all compilers we care about allow unnamed unions... Another hesitation I have is, we might not want to allocate all 32 bits of the mask to glyph flags at this time... Anyway. I'll think about it. One alternative would be to add accessor function with a duplicate macro implementation, like |
An assessor might be the easiest, either way it's not a big deal. Love the functionality! |
This is all fixed now. :) |
Moving from:
https://bugs.freedesktop.org/show_bug.cgi?id=71443
We like to add bits to the buffer to return "safe-to-break-here", which means, if you break text here and shape the two sides separately, you get the same result as shaping together. This is useful for performant line-breaking.
Starting sketch here:
https://gist.github.com/behdad/149ae8947c11afddc560
The text was updated successfully, but these errors were encountered: