mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement the unicode-bidi property
This commit is contained in:
parent
028707f5cd
commit
f8e92b2b01
20 changed files with 128 additions and 71 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue