Sets the type of buffer contents. Buffers are either empty, contain
characters (before shaping), or contain glyphs (the result of shaping).
You rarely need to call this function, since a number of other
functions transition the content type for you. Namely:
A newly created buffer starts with content type
HarfBuzz.buffer_content_type_t.INVALID. Calling hb_buffer_reset(),
hb_buffer_clear_contents(), as well as calling hb_buffer_set_length()
with an argument of zero all set the buffer content type to invalid
as well.
Calling hb_buffer_add_utf8(), hb_buffer_add_utf16(),
hb_buffer_add_utf32(), hb_buffer_add_codepoints() and
hb_buffer_add_latin1() expect that buffer is either empty and
have a content type of invalid, or that buffer content type is
HarfBuzz.buffer_content_type_t.UNICODE, and they also set the content
type to Unicode if they added anything to an empty buffer.
The above transitions are designed such that one can use a buffer
in a loop of "reset : add-text : shape" without needing to ever
modify the content type manually.
Sets the type of
buffercontents. Buffers are either empty, contain characters (before shaping), or contain glyphs (the result of shaping).You rarely need to call this function, since a number of other functions transition the content type for you. Namely:
A newly created buffer starts with content type HarfBuzz.buffer_content_type_t.INVALID. Calling
hb_buffer_reset(),hb_buffer_clear_contents(), as well as callinghb_buffer_set_length()with an argument of zero all set the buffer content type to invalid as well.Calling
hb_buffer_add_utf8(),hb_buffer_add_utf16(),hb_buffer_add_utf32(),hb_buffer_add_codepoints()andhb_buffer_add_latin1()expect that buffer is either empty and have a content type of invalid, or that buffer content type is HarfBuzz.buffer_content_type_t.UNICODE, and they also set the content type to Unicode if they added anything to an empty buffer.Finally
hb_shape()andhb_shape_full()expect that the buffer is either empty and have content type of invalid, or that buffer content type is HarfBuzz.buffer_content_type_t.UNICODE, and upon success they set the buffer content type to HarfBuzz.buffer_content_type_t.GLYPHS.The above transitions are designed such that one can use a buffer in a loop of "reset : add-text : shape" without needing to ever modify the content type manually.