pub struct Script { /* private fields */ }Expand description
An ISO 15924 script identifier (four ASCII letters).
This type stores the canonical Titlecase form (e.g. Latn, Cyrl).
Implementations§
Source§impl Script
impl Script
Sourcepub const fn from_bytes(raw: [u8; 4]) -> Script
pub const fn from_bytes(raw: [u8; 4]) -> Script
Creates a Script from raw ISO 15924 bytes.
The input must be four ASCII bytes in canonical form. This function does not validate.
The ASCII bytes can be provided as a byte array literal:
const LATIN: Script = Script::from_bytes(*b"Latn");Sourcepub const fn from_str_unchecked(s: &str) -> Script
👎Deprecated since 0.1.1: You should use from_bytes(*b"....") instead.
pub const fn from_str_unchecked(s: &str) -> Script
You should use from_bytes(*b"....") instead.
Creates a Script from a 4-byte string literal.
This was intended for const construction and does not validate the input.
This method has been deprecated in favour of Self::from_bytes.
Sourcepub fn parse(s: &str) -> Result<Script, ParseScriptError>
pub fn parse(s: &str) -> Result<Script, ParseScriptError>
Parses an ISO 15924 script identifier.
Parsing is case-insensitive; output is normalized to Titlecase (e.g. LATN → Latn).
Sourcepub const fn is_cursive(self) -> bool
pub const fn is_cursive(self) -> bool
Whether this is a cursive script according to CSS Text 3 Appendix D.
As per that specification, “these scripts do not admit gaps between their letters for either justification or letter-spacing.”
See also CSS Text 3 § 6.4.4 on cursive justification.