HarfBuzz Study: Introducing HarfRust
behdad
June 10, 2025
Introduction
In 2005 there were at least three different Open Source text shaping engines implementing OpenType shaping: in GNOME, KDE, and ICU Layout. I started HarfBuzz to become the Open Source text shaping engine to rule them all!
While I was able to put together a quick library using existing codebases in 2005, thanks to a code donation from Qt, at the end of 2006 I started a rewrite of the entire codebase, codenamed harfbuzz-ng, which is what we simply call HarfBuzz today. It took ten years to release HarfBuzz 1.0.0 (July 2015).
The harfbuzz-ng was designed to be a C++ codebase exposing a C API. Multiple C++ features were part of the core architecture from the beginning, including operator overloading, an expressive type system, template metaprogramming, etc. Currently, the codebase adheres to C++11, the 2011 standard edition of C++.
Other than Linux desktops (GNOME, KDE, and more!) where it originated, HarfBuzz is used in Google Chrome & Mozilla’s Firefox on all platforms, Google’s ChromeOS and Android, Microsoft Edge, Adobe’s Creative Suite (Photoshop, Illustrator, InDesign), OpenJDK (with ICU Layout deprecated by Harfbuzz in 2014), LibreOffice, XeTeX & LuaTeX, gaming engines & consoles, smart TVs & media players, embedded systems, etc, extending its reach to billions of active users.
In this writeup, I expand on our plans for supporting the Rust ecosystem by providing a fully correct, safe, performance-competitive Rust port of HarfBuzz shaping, called HarfRust.
What’s in the name
History
HarfBuzz (حرفباز) is the literal Persian translation of “OpenType”, transliterated using the Latin script. It also means "talkative" or "glib" (also a nod to the GNOME project where HarfBuzz originates from).
Originally there was this font format called TrueType. People and companies started calling their type engines all things ending in Type: FreeType, CoolType, ClearType, DecoType, etc. And then came OpenType, which is the successor of TrueType. So, for my OpenType implementation, I decided to stick with the concept but use the Persian translation. Which is fitting given that Persian is written in the right-to-left Arabic script, and OpenType is an extension of TrueType that adds support for complex script rendering, and HarfBuzz is an implementation of OpenType text shaping.
HarfRust is a Rust port of HarfBuzz. Both names are built on bilingual wordplay using the Persian language.
HarfBuzz (حرفباز)
Combines Harf (حرف), meaning “letter” or “type,” with Buzz, echoing “open” (باز) in Persian. A playful translation of OpenType: “Type–Open.”
HarfRust (حرفراست)
Combines Harf (حرف), meaning “type,” with Rust, echoing the Persian word راست, meaning “true,” “right,” or “honest.” A nod to TrueType, and to Rust's core values of correctness and safety: “Type–True.”
Together, the names trace the typographic evolution from TrueType to OpenType, while reflecting the transition from C++ to Rust in implementation.
Not to be confused with: RustType
RustType is a pure Rust alternative to libraries like FreeType. It is primarily a TrueType font rasterizer. It does not, by design, provide text shaping services.
The contenders
With Rust’s growing popularity, and as de facto successor to C++, the past decade saw multiple attempts to address the need for a text shaping engine in the Rust ecosystem, multiple of which were contributed by their authors to the HarfBuzz github organization.
2017: harfbuzz_rs
harfbuzz_rs is a high-level interface to HarfBuzz, exposing its most important functionality in a safe manner using Rust.
By Manuel Reinhardt. Not a port, but a high-level safe Rust API on top of the harfbuzz-sys bindings of the C++ HarfBuzz library’s shaping facilities. The harfbuzz-sys bindings is developed for use in Mozilla-initiated servo effort. It currently lives under the HarfBuzz github organization.
2019: Allsorts
Open Sourced in 2019, Allsorts was written from the ground up by YesLogic, the company behind the Prince HTML-to-PDF converter. YesLogic contracted Nate ‘n8willis’ Willis to document OpenType shaping, primarily by documenting what HarfBuzz does, which can be found in the OpenType Shaping Documents repository. Allsorts, then, was a clean-room shaper implementation based on that documentation, using custom domain-specific language for font data parsing, and a different architecture than HarfBuzz.
As of this writing, Allsorts does not appear to implement the OpenType Universal Shaping Engine, necessary to support dozens of South-East Asian scripts.
2020: RustyBuzz
Built on top of ttf-parser (2019) by the prolific Yevhenii ‘RazrFalcon’ Reizner, RustyBuzz is a pure rust port of HarfBuzz, initially written to fulfill a need by resvg, an SVG rasterizer.
A client-of-note of RustyBuzz is the typst typesetting engine.
RustyBuzz was declared deprecated by RazrFalcon in August 2023:
@laurmaedje Hi! I'm giving up on this project. I have no further plans on working on it. I know you're using it in typst, so it's probably affects you.
I plan to either archive it or pass to someone else.
As for resvg, which is the reason this projects exists, I haven't decided yet. But basically I have a "choice" of using this deprecated version for now, switch to harfbuzz bindings or try out swash (I'm very skeptical).
Since then, Laurenz Stampfl took over the monumental task of updating RustyBuzz from tracking HarfBuzz 2.7.1 (August 2020) all the way forward to HarfBuzz 10.1.0 (November 2024). However, further major updates are unlikely. I contribute critical bug fixes to the repo. It currently lives under the HarfBuzz github organization.
2021: swash
Swash is a pure Rust, cross-platform crate that provides font introspection, complex text shaping and glyph rendering.
The project is dormant, with developer Chad Brokaw’s time spent on Google’s fontations and HarfRust these days. More on that in the next section.
2025: HarfRust
In 2022, the Google Fonts team started the oxidize effort:
Wherein we contemplate moving shaping, rasterization, font compilation, and general font inspection and manipulation from Python & C++ to Rust.
Most of the work happens in the fontations repository, in various crates: font-types, read-fonts, write-fonts, skrifa, klippa, etc.
A RustyBuzz port to use fontations instead of ttf-parser was discussed. When the interested parties failed to reach an agreement with RazrFalcon in 2024, Chad Brokaw started an unannounced fork, initially called HarfRuzz, after Ruzz, echoing Persian راز, meaning “secret”: “Type–Secret”.
Various interested parties expressed concern about the visual similarity of the HarfRuzz name to HarfBuzz and potential confusion for developers of all kinds, especially those less familiar with the HarfBuzz ecosystem. As such, the project was recently renamed to HarfRust.
Quite late to the party, I started contributing to the project in May and brought it up to date with the latest HarfBuzz release: 11.2.1. Earlier this month, Chad finished porting the project to fontations and finally removed the ttf-parser dependency.
Today, we are excited to announce the first public release of HarfRust: 0.1.0.
Moving forward
The HarfBuzz C++ codebase will be used by various clients for the foreseeable future. Until further notice, all development will primarily happen in HarfBuzz, with the intention to quickly bring HarfRust up to date with each and every HarfBuzz release.
Conclusions
HarfRust is an official HarfBuzz project, currently developed by the Google Fonts team’s Chad Brokaw and contributions from me (currently under contract with Google Fonts funding for 2025).
At the time of this writing, HarfRust passes most of the HarfBuzz shaping test suites, failing just 23 tests out of more than 6,000.
In its current state, HarfRust is over 3x slower than HarfBuzz for major workloads. We plan to address this over the next year to bring the shaping performance very close to HarfBuzz, by porting the various caching schemes from HarfBuzz to HarfRust.
Acknowledgements
I like to thank the Google Fonts team for ongoing support of my work on the HarfBuzz ecosystem. I would like to thank RazrFalcon, Laurenz Stampfl, and Chad Brokaw, without whom HarfRust would not exist.
