From 771e9850fcfd439aebf4310819c7c551c70631b4 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 26 Jan 2024 18:30:39 +0100 Subject: [PATCH] unicode: export bidi details --- unicode/ucd.ha | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/unicode/ucd.ha b/unicode/ucd.ha index 36acbc5..9bcdb3b 100644 --- a/unicode/ucd.ha +++ b/unicode/ucd.ha @@ -94,6 +94,39 @@ export fn gc_code(v: gc) const str = { }; }; +// Bidirectional classification. +export type bidi = enum u8 { + UNKNOWN, + L, + LRE, + LRO, + R, + AL, + RLE, + RLO, + PDF, + EN, + ES, + ET, + AN, + CS, + NSM, + BN, + B, + S, + WS, + ON, + LRI, + RLI, + FSI, + PDI, +}; + +// Returns the [[bidi]] classification corresponding to this rune. +export fn rune_bidi(rn: rune) bidi = { + return get_ucdrecord(rn).bidirectional: bidi; +}; + // Unicode character Script attribute. export type script = enum u16 { COMMON, // Zyyy