Expand description
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
std(enabled by default): This is currently unused and is provided for forward compatibility.bytemuck: Implement traits frombytemuckonGenericFamily.
§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"));Structs§
- Font
Feature - OpenType font feature setting (tag +
u16value). - Font
Variation - OpenType font variation setting (tag +
f32value). - Font
Weight - Visual weight class of a font, typically on a scale from 1.0 to 1000.0.
- Font
Width - Visual width of a font — a relative change from the normal aspect ratio, typically in the
range
0.5to2.0. - Language
- A compact, zero-allocation language tag.
- Parse
Font Family Error - Error returned when parsing CSS
font-familystrings. - Parse
Settings Error - Error returned when parsing OpenType settings source strings.
- Script
- An ISO 15924 script identifier (four ASCII letters).
- Tag
- A 4-byte OpenType tag (for example
wght,liga).
Enums§
- Base
Direction - The paragraph’s base direction.
- Bidi
Control - An inline bidirectional text control.
- Bidi
Direction - Direction choice used by bidi controls.
- Bidi
Override - Direction choice used by bidi overrides.
- Font
Family - CSS
font-familyproperty value. - Font
Family Name - A single named or generic font family.
- Font
Style - Visual style or “slope” of a font.
- Generic
Family - Generic font families, named after CSS.
- Overflow
Wrap - Control over “emergency” line-breaking.
- Parse
Font Family Error Kind - Kinds of errors that can occur when parsing CSS
font-familystrings. - Parse
Language Error - An error returned when parsing a
Languagefails. - Parse
Script Error - An error returned from parsing a
Script. - Parse
Settings Error Kind - Kinds of errors that can occur when parsing OpenType settings source strings.
- Text
Wrap Mode - Control over non-“emergency” line-breaking.
- Word
Break - Control over word breaking, named for the CSS property.