swash

Swash is a pure Rust, cross-platform crate that provides font introspection, complex text shaping and glyph rendering.

Crates.io Docs.rs MIT licensed Apache licensed

Goals

This crate aims to lay the foundation for a cross-platform, high performance set of components for beautiful typography. In particular, this library focuses on fonts and operations that are directly applicable to them. For the most part, the desire is to be unopinionated with respect to resource management, higher level layout and lower level rendering.

Non goals

Due to the intention of being generally useful and easy to integrate, the following areas of related interest are specifically avoided:

General features

Introspection

Complex text shaping

Scaling

Text analysis

Performance

Performance is a primary goal for this crate and preliminary microbenchmarks show a general improvement over FreeType and Harfbuzz by about 10-20% on average and some cases show substantial wins, particularly when scaling Postscript outlines or shaping text with complex features. Specifically, shaping runs with fonts like Calibri and Noto Sans Myanmar is almost twice as fast. Simple fonts and pure ASCII runs tend to show the smallest gains as those simply measure shaper initialization and glyph iteration. A comprehensive set of benchmarks (and test cases!) are needed here to gain more insight and track regressions.

Contributing

Contributions are welcome and appreciated! All contributions must be granted under the licenses under which this project is released.

About me

This project has been a long term goal of mine and I haphazardly decided to take it on as my first major foray into Rust. What a ride! I've grown quite fond of development in Rust and would be interested if there are any employers out there looking for someone who can competently wrangle the borrow checker. Doubly interested if the work involves text rendering or general 2D (or 3D!) graphics development. Alternatively, please consider supporting me on patreon or contacting me about sponsorship if you find this project useful.