Home

Awesome

harfruzz

Build Status Crates.io Documentation

harfruzz is a fork of rustybuzz to explore porting from ttf-parser to read-fonts to avoid shipping (and maintaining) multiple implementations of core font parsing for skrifa consumers. Further context in https://github.com/googlefonts/fontations/issues/956.

rustybuzz is a complete harfbuzz's shaping algorithm port to Rust.

Matches harfbuzz v9.0.0.

Why?

https://github.com/googlefonts/oxidize outlines Google Fonts motivations to try to migrate font production and consumption to Rust.

Conformance

The following conformance issues need to be fixed:

Major changes

Performance

At the moment, performance isn't that great. We're 1.5-2x slower than harfbuzz.

See benches/README.md for details.

Notes about the port

harfruzz is not a faithful port.

harfbuzz (C++ edition) can roughly be split into 6 parts:

  1. shaping, handled by harfruzz
  2. subsetting, (hb-subset) moves to a standalone crate, klippa
  3. TrueType parsing, handled by read-fonts
  4. Unicode routines, migrated to external crates
  5. custom containers and utilities (harfbuzz doesn't use C++ std), reimplemented in fontations where appropriate (e.g. int set)
  6. glue for system/3rd party libraries, just gone

Lines of code

You can find the "real" code size (eliminating generated code) using:

tokei --exclude hb/unicode_norm.rs --exclude hb/ot_shaper_vowel_constraints.rs \
      --exclude '*_machine.rs' --exclude '*_table.rs' src

Future work

Since the port is finished, there is not much to do other than syncing it with a new harfbuzz releases. However, there is still lots of potential areas of improvement:

All of this is a lot of work, so contributions are more than welcome.

Safety

Unsafe code is forbidden by a #![forbid(unsafe_code)] attribute in the root of the library.

Alternatives

License

harfruzz is licensed under the MIT license.

harfbuzz is licensed under the Old MIT