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.
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.
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 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.
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:
HarfBuzz is used directly by many applications, including: