Skip to main content

Crate use_script

Crate use_script 

Source
Expand description

§use-script

Small writing script subtag primitives for RustUse.

§Example

use use_script::{is_script_code, parse_script_code};

let script = parse_script_code("latn").unwrap();

assert_eq!(script.as_str(), "Latn");
assert!(is_script_code("Cyrl"));

§Scope

  • Validate 4-letter script subtags.
  • Normalize script subtags to title case.
  • Provide a small ScriptCode newtype for validated script subtags.

§Non-goals

  • Unicode text shaping.
  • Font selection.
  • Transliteration.
  • Script detection.

§License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

Structs§

ScriptCode
A normalized 4-letter writing script subtag.

Functions§

is_script_code
Returns true when the input is a 4-letter script subtag.
normalize_script_code
Normalizes a 4-letter script subtag to title case.
parse_script_code
Parses a script subtag and normalizes it to title case.