HarfBuzz is a text-shaping engine. If you give HarfBuzz a font and a string containing a sequence of Unicode codepoints, HarfBuzz selects and positions the corresponding glyphs from the font, applying all of the necessary layout rules and font features. HarfBuzz then returns the string to you in the form that is correctly arranged for the language and writing system.
HarfBuzz can properly shape all of the world's major writing systems. It runs on all major operating systems and software platforms and it supports the major font formats in use today.
Text shaping is the process of translating a string of character codes (such as Unicode codepoints) into a properly arranged sequence of glyphs that can be rendered onto a screen or into final output form for inclusion in a document.
The shaping process is dependent on the input string, the active font, the script (or writing system) that the string is in, and the language that the string is in.
Modern software systems generally only deal with strings in the Unicode encoding scheme (although legacy systems and documents may involve other encodings).
There are several font formats that a program might encounter, each of which has a set of standard text-shaping rules.
The dominant format is OpenType. The
OpenType specification defines a series of shaping models for
various scripts from around the world. These shaping models depend on
the font incorporating certain features as
lookups in its GSUB
and GPOS
tables.
Alternatively, OpenType fonts can include shaping features for the Graphite shaping model.
TrueType fonts can also include OpenType shaping features. Alternatively, TrueType fonts can also include Apple Advanced Typography (AAT) tables to implement shaping support. AAT fonts are generally only found on macOS and iOS systems.
Text strings will usually be tagged with a script and language tag that provide the context needed to perform text shaping correctly. The necessary script and language tags are defined by OpenType.