How HarfBuzz Works From Unicode to positioned glyphs, and everything in between
HarfBuzz 15.2.0
Contents

Reading this book

The views of a table

Font data can be shown in several ways, and different readers know different ones. Wherever this book shows a lookup, it starts in the spec-like view, and its tabs switch it to the others. Each lookup’s tabs change only that lookup.In print, a lookup is shown in the spec-like view, and where the text discusses other views, in those too, each labeled. The web edition has all five for every lookup.

A view that doesn’t exist for a particular table (bytes, say, for a kind of subtable the book doesn’t decode) falls back to the spec-like view.

None of the views is written by hand. Each is made from the compiled font, or from the HarfBuzz source, when the book is built.

Shaping results

Results are shown as hb-shape prints them (The command-line tools explains all its switches):

[f_i=0+900|acutecomb=0@-675,562+0]

Each glyph is name=cluster, then @x,y if it is offset, then +advance. Glyphs are listed in visual order. Text that is hard to see is spelled out: ◌́ is a combining mark on a dotted circle, ⟨ZWJ⟩ and ⟨ZWNJ⟩ are the joiners, and ␣ is a space. The Unicode code points are listed under each piece of text, and the text itself is set in the page’s own font, not the test font. Where a test font has real outlines, as in Why shaping exists, the text is drawn instead, each character on its own with the glyph the font’s cmap gives it, and a last column draws the shaped result.

Traces

A trace is HarfBuzz’s own account of what it did, from hb-shape --trace: each step’s name, and the buffer after it. Traces in this book come from a HarfBuzz built with HB_BUFFER_MESSAGE_MORE, which adds detail inside lookups (“ligating glyphs at 0,2”); Building HarfBuzz shows how, and The command-line tools how to ask for a trace.

Drawings

Some figures draw glyphs, with hb-vector, and show hb-shape’s result beneath each drawing. A drawing of a variable font shows it at more than one position in its design space. Its slider moves along one axis, and every position it can show was drawn when the book was built.In print, a row of frames shows a few positions along one axis, each labeled with its value; the web edition has a slider, with every position drawn.

References to HarfBuzz’s source give a file and a line, such as hb-ot-map.cc:382, and always mean HarfBuzz 15.2.0: the line can be found in its repository at github.com/harfbuzz/harfbuzz, under the tag 15.2.0. Each one links to that line. On screen, each one links to that line.

Links to other chapters, and out of the book, work as on any web page.Links to other parts of the book are in color, followed by the page they lead to, such as “(p. 121)”. Links out of the book are in color with a small note number, and their addresses are listed, by number, at the end of the chapter, under “Links”.