Implement the unicode-bidi property

This commit is contained in:
Matt Brubeck 2015-07-23 10:16:45 -07:00
parent 028707f5cd
commit f8e92b2b01
20 changed files with 128 additions and 71 deletions

View file

@ -92,9 +92,9 @@ pub fn transform_text(text: &str,
}
}
fn is_always_discardable_char(_ch: char) -> bool {
// TODO: check for bidi control chars, soft hyphens.
false
fn is_always_discardable_char(ch: char) -> bool {
// TODO: check for soft hyphens.
is_bidi_control(ch)
}
}
@ -105,3 +105,12 @@ pub fn float_to_fixed(before: usize, f: f64) -> i32 {
pub fn fixed_to_float(before: usize, f: i32) -> f64 {
f as f64 * 1.0f64 / ((1i32 << before) as f64)
}
pub fn is_bidi_control(c: char) -> bool {
match c {
'\u{202A}'...'\u{202E}' => true,
'\u{2066}'...'\u{2069}' => true,
'\u{200E}' | '\u{200F}' | '\u{061C}' => true,
_ => false
}
}