Object types: Opaque struct types are used
for what HarfBuzz loosely calls "objects." This doesn’t have
much to do with the terminology from object-oriented programming
(OOP), although some of the concepts are similar.
In HarfBuzz, all object types provide certain
lifecycle-management APIs. Objects are reference-counted, and
constructed with various create()
methods, referenced via
reference()
and dereferenced using
destroy()
.
For example,
the hb_buffer_t
object has
hb_buffer_create()
as its constructor,
hb_buffer_reference()
to reference, and
hb_buffer_destroy()
to dereference.
After construction, each object's properties are accessible only
through the setter and getter functions described in the API
Reference manual.
Key object types provided by HarfBuzz include:
blobs, which act as low-level wrappers around binary
data. Blobs are typically used to hold the contents of a
binary font file.
faces, which represent typefaces from a
font file, but without specific parameters (such as size) set.
fonts, which represent instances of a
face with all of their parameters specified.
buffers, which hold Unicode code points
for characters (before shaping) and the shaped glyph output
(after shaping).
shape plans, which store the settings
that HarfBuzz will use when shaping a particular text
segment. Shape plans are not generally used by client
programs directly, but as we will see in a later chapter,
they are still valuable to understand.