-
Notifications
You must be signed in to change notification settings - Fork 591
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
Request for documentation clarification #4000
Comments
The wording is a bit unfortunate. The automatic state transitions work like this: HB_BUFFER_CONTENT_TYPE_INVALID --- hb_buffer_add_utf8/16/32 ---> HB_BUFFER_CONTENT_TYPE_UNICODE --- hb_shape ---> HB_BUFFER_CONTENT_TYPE_GLYPHS The only case where you want to manually call hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_UNICODE) is when you want to reuse a buffer for new text after hb_shape has been called. |
Also |
Even then setting the buffer length to zero resets the content type to INVALID, so it works. |
Right. So that needs to be documented. And what Matthias wrote should be documented. |
Great, this is helpful.
|
It would be excellent to write some tests for these state changes too |
Correct.
It asserts that state is not
No. The contents are not modified.
We assert, so you get a crash if debugging is enabled. Otherwise, the functions set the type to what they expect it to be. |
I wrote the above discussion in: |
I have a few questions about the use of the API which weren't clear from the documentation.
Specifically,
hb_buffer
s are stateful, but it's somewhat unclear about how and when the state transitions, and what invariants are maintained.From the documentation:
reset()
?TYPE_GLYPHS
, or glyph data when the state isTYPE_UNICODE
?I'd love to know the answers; even better if the docs are updated so future devs can benefit! Apologies if I missed anything that's already there. :)
The text was updated successfully, but these errors were encountered: