unsupported +ˆl–ßi~””†»Ò�vàp©‹Fÿ¿ ƒx/¹_‡I|¥‰ÓMà Shaping and shape plans: HarfBuzz Manual

Shaping and shape plans

Shaping and buffer output
OpenType features
Shaper selection
Plans and caching

Once you have your face and font objects configured as desired and your input buffer is filled with the characters you need to shape, all you need to do is call hb_shape().

HarfBuzz will return the shaped version of the text in the same buffer that you provided, but it will be in output mode. At that point, you can iterate through the glyphs in the buffer, drawing each one at the specified position or handing them off to the appropriate graphics library.

For the most part, HarfBuzz's shaping step is straightforward from the outside. But that doesn't mean there will never be cases where you want to look under the hood and see what is happening on the inside. HarfBuzz provides facilities for doing that, too.

Shaping and buffer output

The hb_shape() function call takes four arguments: the font object to use, the buffer of characters to shape, an array of user-specified features to apply, and the length of that feature array. The feature array can be NULL, so for the sake of simplicity we will start with that case.

Internally, HarfBuzz looks at the tables of the font file to determine where glyph classes, substitutions, and positioning are defined, using that information to decide which shaper to use (ot for OpenType fonts, aat for Apple Advanced Typography fonts, and so on). It also looks at the direction, script, and language properties of the segment to figure out which script-specific shaping model is needed