8000 GitHub - harfbuzz/harfrust: Port of RustyBuzz to use Fontations
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

harfbuzz/harfrust

Repository files navigation

Build Status Crates.io Documentation

HarfRust

HarfRust is a Rust port of HarfBuzz text shaping engine. See Major changes below for major differences between HarfRust and HarfBuzz.

HarfRust started as 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 googlefonts/fontations#956.

Matches HarfBuzz v11.2.1.

Why?

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

Major changes

  • No font size property. Shaping is always using UnitsPerEm. You should scale the result manually.
  • Most of the font loading and parsing is done using read-fonts.
  • HarfRust doesn't provide any integration with external libraries, so no FreeType, CoreText, or Uniscribe/DirectWrite font-loading integration, and no ICU, or GLib Unicode-functions integration, as well as no graphite2 library support.
  • mort table is not supported, since it's deprecated by Apple.
  • No graphite library support.

Conformance

The following conformance issues need to be fixed:

  • HarfRust does not yet fully pass the HarfBuzz shaping or fuzzing tests
  • Malformed fonts will cause an error. HarfBuzz uses fallback/dummy shaper in this case.
  • No Arabic fallback shaper. This requires the ability to build lookups on the fly. In HarfBuzz (C++) this requires serialization code that is associated with subsetting.
  • avar2 as well as other parts of the boring-expansion-spec are not supported yet.

Performance

At the moment, performance isn't that great. HarfRust can be 3x slower than HarfBuzz.

See benches/README.md for details.

Notes about the port

HarfRust is not a full port of HarfBuzz. HarfBuzz (C++ edition) can roughly be split into 6 parts:

  1. shaping, ported to HarfRust
  2. Unicode routines, ported to HarfRust
  3. font parsing, handled by read-fonts
  4. subsetting, handled by klippa
  5. custom containers and utilities (HarfBuzz doesn't use C++ standard library), reimplemented in fontations where appropriate (e.g. int set)
  6. glue for system/3rd party libraries, not ported

Safety

The library is completely safe.

There are no unsafe in this library and in most of its dependencies (excluding bytemuck).

Developer documents

For notes on the backporting process of HarfBuzz code, see docs/backporting.md.

For notes on generating state machine using ragel, see docs/ragel.md.

The following HarfBuzz studies are relevant to HarfRust development:

License

HarfRust is licensed under the MIT license.

HarfBuzz is licensed under the Old MIT

About

Port of RustyBuzz to use Fontations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 27

0