HarfBuzz at 20: History, Performance Improvements, the HarfRust Port, and WebAssembly in Fonts

Web Engines Hackfest

Summary:
  • HarfBuzz is a ubiquitous open-source text-shaping engine that celebrated its 20th anniversary, powering text rendering across most modern operating systems, browsers, and devices.
  • Initially designed in C++ with a stable C API, HarfBuzz has evolved beyond basic shaping to include rendering layers (rasterizer, vectorizer, GPU renderer) and font-subsetting libraries to optimize web fonts.
  • Over the past five years, the project achieved massive performance optimizations driven by Chromium's benchmarks, making it up to three to seven times faster for some fonts.
  • A major recent development is HarfRust, a high-fidelity safe Rust port of HarfBuzz that reduces performance overhead to just 20% compared to C++ while maintaining compliance with nearly all test suites.
  • The speaker discusses extending the OpenType format through ISO standardization (e.g., avar2, VARC) to reduce file sizes by up to 90% for complex scripts like Hangul.
  • An innovative, "long-shot" proposal is presented: embedding WebAssembly (WASM) directly into font files to allow programmable shaping logic, bypassing rigid format limits and enabling advanced features like optical positioning and recursive box modeling.

Performance optimizations in HarfBuzz over five years across different scripts and fonts
Performance optimizations in HarfBuzz over five years across different scripts and fonts [ 00:08:50 ]

Introduction and Capabilities of HarfBuzz [00:00:17]

20-Year History and Broad Adoption [00:02:11]

Performance optimizations in HarfBuzz over five years across different scripts and fonts
Performance optimizations in HarfBuzz over five years across different scripts and fonts [ 00:08:50 ]

HarfRust: Safe Text Shaping in Rust [00:09:48]

The history of Rust-based text shaping engines leading to HarfRust
The history of Rust-based text shaping engines leading to HarfRust [ 00:10:00 ]

HarfRust OpenType shaping performance compared to native C++ HarfBuzz
HarfRust OpenType shaping performance compared to native C++ HarfBuzz [ 00:12:20 ]
HarfRust Apple Advanced Typography (AAT) shaping performance compared to native C++ HarfBuzz
HarfRust Apple Advanced Typography (AAT) shaping performance compared to native C++ HarfBuzz [ 00:12:48 ]

Standardizing Font Format Extensions [00:13:57]

Font format extensions and their corresponding file size savings
Font format extensions and their corresponding file size savings [ 00:14:40 ]

WebAssembly in the Font (The Long Shot) [00:16:30]

Demos & Questions [00:19:24] [00:25:21]