Parley provides an API for implementing rich text layout.
Parley has four key dependencies: Fontique, HarfRust, Skrifa, and Swash. These crates cover different pieces of the text-rendering process.
Fontique provides font enumeration and fallback.
Font enumeration means listing (enumerating) all the fonts installed on the system. It also means collecting metadata about those fonts: whether they are serif, sans-serif, monospace, their weight, the code points they cover, etc. The library is responsible for loading fonts into memory; it will use memory-mapped IO to load portions into memory lazily and share them between processes on the system.
Font fallback is matching runs of text to a font. This is necessary because fonts typically don't cover the entire Unicode range: you have different fonts for latin text, chinese text, arabic text, etc and also usually a separate font for emoji. But if you have, say arabic text or emoji embedded within latin text, you don't typically specify the font for the arabic text or the emoji, one is chosen for you. Font fallback is the process which makes that choice.
HarfRust is a Rust port of HarfBuzz text shaping engine. Text shaping means mapping runs of Unicode codepoints to specific glyphs within fonts. This includes applying ligatures, resolving emoji modifiers, but also much more complex transformations for some scripts.
Skrifa reads TrueType and OpenType fonts.
It is built on top of the read-fonts low-level parsing library and is also part of the oxidize project.
Skrifa provides higher level metrics on top of read-fonts. Notably it converts the raw glyph representations in font files into scaled, hinted vector paths suitable for rasterisation.
Within the context of Parley, Swash implements some miscellaneous Unicode-related features.
Parley itself does text layout and includes utilities for text selection and editing.
Text layout means computing x/y coordinates for each glyph in a string of text. Besides what the other libraries do, this involves things like determining a glyph's size, line breaking, and bidi resolution.
This version of Parley has been verified to compile with Rust 1.82 and later.
Future versions of Parley might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases.
Click here if compiling fails.
As time has passed, some of Parley's dependencies could have released versions with a higher Rust requirement. If you encounter a compilation issue due to a dependency and don't want to upgrade your Rust toolchain, then you could downgrade the dependency.
# Use the problematic dependency's name and version
cargo update -p package_name --precise 0.1.1
Discussion of Parley development happens in the Linebender Zulip, specifically the #parley channel. All public content can be read without logging in.
Contributions are welcome by pull request. The Rust code of conduct applies.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache 2.0 license, shall be licensed as noted in the License section, without any additional terms or conditions.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Some files used for tests and benchmarks are under different licenses. See ./parley_dev/README.md
for details.