ArticleslgStudy

computer science

HarfBuzz

HarfBuzz is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand HarfBuzz rather than just read about it. In short: HarfBuzz (loose transliteration of Persian calque حرف‌باز harf-bāz, literally "open type") is an open-source text shaping engine written in C++. Text shaping is the process of converting a sequence of Unicode code points into the correct glyph identifiers and precise positions needed to render text on screen or in print.

HarfBuzz — main illustration
HarfBuzz — illustration

Key takeaways

  • HarfBuzz belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect HarfBuzz to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of HarfBuzz from memory before moving on to harder problems.

Reference excerpt

HarfBuzz (loose transliteration of Persian calque حرف‌باز harf-bāz, literally "open type") is an open-source text shaping engine written in C++. Text shaping is the process of converting a sequence of Unicode code points into the correct glyph identifiers and precise positions needed to render text on screen or in print. For scripts where characters change shape depending on their neighbours (such as Arabic, Devanagari, or Tamil), text shaping ensures that the right glyph forms are selected and joined correctly. Without it, text renderers would display raw disconnected code points rather than readable words. HarfBuzz takes a string of Unicode text, a font file, and information about the writing script and language as input. It returns a list of glyph IDs and their x/y positions, which a rendering engine such as Cairo or Skia then uses to draw the text. The library supports multiple font technologies, including OpenType, Apple Advanced Typography (AAT), and SIL Graphite. The project originated in the FreeType codebase and went through several development phases before Behdad Esfahbod rewrote it from scratch around 2012. It is now used by major operating systems, browsers, and desktop toolkits worldwide.

History HarfBuzz evolved from shaping code that was originally part of the FreeType project. That code was forked separately into both Qt and Pango, leaving two diverging implementations. The two forks were eventually merged back into a shared repository under an MIT license, forming what is now called Old HarfBuzz. Old HarfBuzz supported only OpenType fonts and is no longer maintained. Around 2010–2012, Behdad Esfahbod rewrote the library from scratch in C++, producing New HarfBuzz. The rewrite discarded the old architecture and was designed from the outset to support multiple font technologies and complex script shaping rules. In 2013, Esfahbod received the O'Reilly Open Source Award for his work on HarfBuzz. The same year, Android adopted HarfBuzz as its text shaping engine, bringing the library to hundreds of millions of devices. Over the following years, the library's script and font format coverage grew. Early releases added SIL Graphite support, and the 1.0 release in 2015 incorporated the Universal Shaping Engine, a generalised shaping model developed by Microsoft that covers dozens of scripts not individually defined in the OpenType specification. Subsequent work broadened the range of supported font technologies to include OpenType font variations, Apple Advanced Typography shaping, and colour fonts. A font subsetter API, stabilised in 2021, allows tools to produce optimised font subsets for web and embedded use. In 2023, an experimental shaper was added that allows fonts to embed WebAssembly programs to handle their own shaping logic.

Architecture HarfBuzz is a C++ library with a C API. A caller provides three inputs: a buffer containing Unicode text, a font object loaded from a font file, and optional metadata about the writing script and language. HarfBuzz returns the same buffer populated with glyph IDs and x/y advance and offset values. The caller then passes those values to a drawing library to paint the glyphs. Internally, HarfBuzz selects a shaping engine based on the font format and script:

The OpenType shaper handles the majority of scripts. It reads the GSUB (glyph substitution) and GPOS (glyph positioning) tables from the font and applies their rules in the order specified by the OpenType specification for each script. The Universal Shaping Engine (USE) shaper covers scripts in the OpenType specification that do not have dedicated shaping logic, using a generalised finite-state model. The Apple Advanced Typography (AAT) shaper reads AAT morx and kerx tables, enabling HarfBuzz to shape fonts distributed in Apple's format. The SIL Graphite shaper hands off processing to the embedded Graphite engine, which evaluates rules stored inside Graphite-enabled fonts. An experimental WebAssembly shaper allows a font to include a Wasm binary that takes full control of shaping for that font. The library also includes a subsetter API that produces optimised font subsets containing only the glyphs needed for a particular document, reducing file sizes in web and embedded contexts.

Users Most applications use HarfBuzz indirectly through a UI toolkit or text layout library that integrates it, rather than calling HarfBuzz directly. The library is used across a range of platforms, from mobile operating systems to professional desktop publishing software. HarfBuzz is used by the UI libraries of:

GNOME (GTK) KDE (Qt) ChromeOS (Skia) PlayStation 4 Android Java Flutter Godot (since version 4.0) Unity (since version 6.0) OpenHarmony (HarmonyOS) HarfBuzz is used directly by many applications, including:

Chromium Firefox LibreOffice (from version 4.1 on Linux, from 5.3 on all platforms) Scribus (since version 1.5.3) Inkscape Adobe Photoshop (since version 23.0) Adobe InDesign (when using World Ready Composer since InDesign 19.0) Figma XeTeX (since version 0.9999) LuaTeX (since version 1.11.1) QuarkXPress

See also

Cairo (graphics) Graphite (smart font technology), a programmable Unicode-compliant smart-font technology and rendering system developed by SIL International Uniscribe and DirectWrite, APIs providing similar functionality on Microsoft Windows Core Text, the macOS equivalent (HarfBuzz can be used as an alternative on macOS)

References

External links Official website harfbuzz/harfbuzz on GitHub Old HarfBuzz (archived)

Worked examples

Example 1 — a first encounter with HarfBuzz

Start with the simplest possible case. Write down what HarfBuzz claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to HarfBuzz before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about HarfBuzz ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of HarfBuzz

In research
HarfBuzz appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses HarfBuzz in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
HarfBuzz is common in secondary-school and first-year university syllabi. It links to neighbouring topics Digital typography, Free computer libraries, Free software programmed in C++, so understanding it makes those chapters shorter.
In everyday life
Look for HarfBuzz outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “HarfBuzz” →

How to study HarfBuzz in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what HarfBuzz means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain HarfBuzz out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is HarfBuzz in simple terms?

HarfBuzz (loose transliteration of Persian calque حرف‌باز harf-bāz, literally "open type") is an open-source text shaping engine written in C++. Text shaping is the process of converting a sequence of Unicode code points into the correct glyph identifiers and precise positions needed to render text…

Why does HarfBuzz matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study HarfBuzz?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on HarfBuzz.

Tags

  • Digital typography
  • Free computer libraries
  • Free software programmed in C++
  • Freedesktop.org
  • GNOME libraries
  • Software using the MIT license
  • Text rendering libraries

Keep exploring