4:28 "ˆl–ßi~” *j"Tâ€zãB¸'TÅ£¿ ƒh¹ÃÂ4:3 �Áa–ßi~” *j"Tâ€zãMܪbÑ¿ÃFile not found. +ˆl–ßi~””†»Ò�vàp©‹FÿÁ ƒmà_‡I|¥‰ÓMÀŨ Adding text to the buffer: HarfBuzz Manual

Adding text to the buffer

Now we have a brand new HarfBuzz buffer. Let's start filling it with text! From HarfBuzz's perspective, a buffer is just a stream of Unicode code points, but your input string is probably in one of the standard Unicode character encodings (UTF-8, UTF-16, or UTF-32). HarfBuzz provides convenience functions that accept each of these encodings: hb_buffer_add_utf8(), hb_buffer_add_utf16(), and hb_buffer_add_utf32(). Other than the character encoding they accept, they function identically.

You can add UTF-8 text to a buffer by passing in the text array, the array's length, an offset into the array for the first character to add, and the length of the segment to add:

    hb_buffer_add_utf8 (hb_buffer_t *buf,
                    const char *text,
                    int text_length,
                    unsigned int item_offset,
                    int item_length)
    

So, in practice, you can say:

      hb_buffer_add_utf8(buf, text, strlen(text), 0, strlen(text));
    

This will append your new characters to buf, not replace its existing contents. Also, note that you can use -1 in place of the first instance of strlen(text) if your text array is NULL-terminated. Similarly, you can also use -1 as the final argument want to add its full contents.

Whatever start item_offset and item_length you provide, HarfBuzz will also attempt to grab the five characters before the offset point and the five characters after the designated end. These are the before and after