set_content_type


Description:

[ Version ( since = "0.9.5" ) ]
public void set_content_type (BufferContentType content_type)

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 hb_buffer_content_type_invalid. Calling reset, clear_contents, as well as calling set_length with an argument of zero all set the buffer content type to invalid as well.
  • Calling add_utf8, add_utf16, add_utf32, add_codepoints and add_latin1 expect that buffer is either empty and have a content type of invalid, or that buffer content type is hb_buffer_content_type_unicode, and they also set the content type to Unicode if they added anything to an empty buffer.
  • Finally shape and shape_full expect that the buffer is either empty and have content type of invalid, or that buffer content type is hb_buffer_content_type_unicode, and upon success they set the buffer content type to hb_buffer_content_type_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.

Parameters:

content_type

The type of buffer contents to set

buffer

An Buffer