[gfx] [layout] [style] Upgrade unicode-bidi to 0.3

This commit is contained in:
Behnam Esfahbod 2017-05-16 11:38:42 -05:00
parent 594479fe15
commit 14c524df4f
10 changed files with 61 additions and 34 deletions

View file

@ -10,6 +10,7 @@ use euclid::side_offsets::SideOffsets2D;
use std::cmp::{max, min};
use std::fmt::{self, Debug, Error, Formatter};
use std::ops::{Add, Sub};
use unicode_bidi as bidi;
pub enum BlockFlowDirection {
TopToBottom,
@ -131,9 +132,13 @@ impl WritingMode {
#[inline]
/// The default bidirectional embedding level for this writing mode.
///
/// Returns 0 if the mode is LTR, or 1 otherwise.
pub fn to_bidi_level(&self) -> u8 {
!self.is_bidi_ltr() as u8
/// Returns bidi level 0 if the mode is LTR, or 1 otherwise.
pub fn to_bidi_level(&self) -> bidi::Level {
if self.is_bidi_ltr() {
bidi::Level::ltr()
} else {
bidi::Level::rtl()
}
}
}