manpagez: man pages & more
html files: harfbuzz
Home | html | info | man

Blobs

While most of HarfBuzz's object types are specific to the shaping process, blobs are somewhat different.

Blobs are an abstraction designed to negotiate lifecycle and permissions for raw pieces of data. For example, when you load the raw font data into memory and want to pass it to HarfBuzz, you do so in a hb_blob_t wrapper.

This allows you to take advantage of HarfBuzz's reference-counting and destroy callbacks. If you allocated the memory for the data using malloc(), you would create the blob using

      hb_blob_create (data, length, HB_MEMORY_MODE_WRITABLE, data, free)
    

That way, HarfBuzz will call free() on the allocated memory whenever the blob drops its last reference and is deconstructed. Consequently, the user code can stop worrying about freeing memory and let the reference-counting machinery take care of that.

Most of the time, blobs are read-only, facilitating their use in immutable objects.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.