Parley Engine
Low level text layout
Parley Engine provides low level APIs for shaping paragraphs of text.
Usage
Use Analyzer, Analysis, Shaper and ShapedText to shape a paragraph of text into
glyphs. Correct reshaping of lines is in progress; in the meantime you can break text at
Atom or ShapedCluster boundaries.
Text analysis is performed before shaping, and the same source string must be passed to each stage.
Higher-level users may prefer using parley, which uses this crate and implements
layout and styling.
let mut analysis = default;
let mut analyzer = default;
let mut shaped_text = default;
let mut shaper = default;
let text = "The quick brown ثعلب jumps over the lazy dog.";
let char_count = text.chars.count;
let char_style_indices = vec!;
analyzer.analyze;
shaper.shape_text;
for in shaped_text.runs.iter.enumerate
Features
The following crate feature flags are available:
std(enabled by default): Get floating point functions from the standard library (likely using your target's libc).libm: Use floating point implementations from libm. This is useful forno_stdenvironments. However, note that thelibmcrate is not as efficient as the standard library.bytemuck: Forwarded toparlancewhich then implements traits frombytemuckon its types.complex-scripts: Enable dictionary-based line and word breaking for complex scripts (CJK, Thai, Khmer, Lao, Myanmar). When disabled, a lightweight segmenter is used that falls back to character-level breaks for those scripts. SeeDictionaryProviderfor full details.
At least one of std and libm is required; std overrides libm.
Note that Parley Engine requires that an allocator is available (i.e. it uses alloc).
Minimum supported Rust Version (MSRV)
This version of Parley Engine has been verified to compile with Rust 1.88 and later.
Future versions of Parley Engine 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.
As time has passed, some of Parley Engine'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
Community
Discussion of Parley Engine development happens in the Linebender Zulip, specifically the #parley channel. All public content can be read without logging in.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Contributions are welcome by pull request. The Rust code of conduct applies. Please feel free to add your name to the AUTHORS file in any substantive pull request.
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 above, without any additional terms or conditions.