parley/parlance at main · linebender/parley · GitHub
Skip to content

Latest commit

 

History

History

parlance

Folders and files

README.md

Parlance

Fundamental text property types

Latest published version. Documentation build status. Apache 2.0 or MIT license.
Linebender Zulip chat. GitHub Actions CI status. Dependency staleness status.

Fundamental text property types.

This crate is intended as a lightweight, no_std-friendly vocabulary layer that can be shared across style systems, text layout engines, and font tooling. It focuses on small, typed representations of common “leaf” concepts (weights, widths, OpenType tags, language tags, etc).

Features

The following crate feature flags are available:

  • std (enabled by default): This is currently unused and is provided for forward compatibility.
  • bytemuck: Implement traits from bytemuck on GenericFamily, BidiLevel and NormalizedCoord.

Note that Parlance requires that an allocator is available (i.e. it uses alloc).

Example

use parlance::{Language, Tag};

let tag = Tag::parse("wght").unwrap();
assert_eq!(tag.to_bytes(), *b"wght");

let lang = Language::parse("zh-Hans-CN").unwrap();
assert_eq!(lang.as_str(), "zh-Hans-CN");
assert_eq!(lang.language(), "zh");
assert_eq!(lang.script(), Some("Hans"));
assert_eq!(lang.region(), Some("CN"));

Minimum supported Rust Version (MSRV)

This version of Parlance has been verified to compile with Rust 1.88 and later.

Future versions of Parlance 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.

Community

Discussion of Parlance development happens in the Linebender Zulip, specifically the #parley channel. All public content can be read without logging in.

License

Licensed under either of

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.