diff --git a/src/hb/buffer.rs b/src/hb/buffer.rs index b05707cf..82402f93 100644 --- a/src/hb/buffer.rs +++ b/src/hb/buffer.rs @@ -582,8 +582,9 @@ impl hb_buffer_t { } let mut start = 0; + let mut i = 1; - for i in 1..self.len { + while i < self.len { if !group(&self.info[i - 1], &self.info[i]) { if merge_clusters { self.merge_clusters(start, i); @@ -593,14 +594,16 @@ impl hb_buffer_t { start = i; } - if merge_clusters { - self.merge_clusters(start, i); - } - - self.reverse_range(start, i); + i += 1; + } - self.reverse(); + if merge_clusters { + self.merge_clusters(start, i); } + + self.reverse_range(start, i); + + self.reverse(); } pub fn group_end(&self, mut start: usize, group: F) -> usize diff --git a/src/hb/unicode.rs b/src/hb/unicode.rs index c161aed8..14082521 100644 --- a/src/hb/unicode.rs +++ b/src/hb/unicode.rs @@ -842,7 +842,7 @@ mod tests { fn check_unicode_version() { assert_eq!(unicode_bidi_mirroring::UNICODE_VERSION, (15, 1, 0)); assert_eq!(unicode_ccc::UNICODE_VERSION, (15, 0, 0)); - assert_eq!(unicode_properties::UNICODE_VERSION, (15, 0, 0)); + assert_eq!(unicode_properties::UNICODE_VERSION, (15, 1, 0)); assert_eq!(unicode_script::UNICODE_VERSION, (15, 1, 0)); assert_eq!(crate::hb::unicode_norm::UNICODE_VERSION, (15, 0, 0)); } diff --git a/tests/custom/bugs.tests b/tests/custom/bugs.tests new file mode 100644 index 00000000..819c0415 --- /dev/null +++ b/tests/custom/bugs.tests @@ -0,0 +1 @@ +tests/fonts/rb_custom/NotoSansCJK.subset1.otf;--direction rtl;U+4F60,U+597D,U+FF0C; \ No newline at end of file diff --git a/tests/fonts/rb_custom/NotoSansCJK.subset1.otf b/tests/fonts/rb_custom/NotoSansCJK.subset1.otf new file mode 100644 index 00000000..1a8209c2 Binary files /dev/null and b/tests/fonts/rb_custom/NotoSansCJK.subset1.otf differ diff --git a/tests/shaping/custom.rs b/tests/shaping/custom.rs index bb72f93b..d0f73b30 100644 --- a/tests/shaping/custom.rs +++ b/tests/shaping/custom.rs @@ -2,6 +2,20 @@ use crate::shape; +#[test] +fn bugs_001() { + assert_eq!( + shape( + "tests/fonts/rb_custom/NotoSansCJK.subset1.otf", + "\u{4F60}\u{597D}\u{FF0C}", + "--direction rtl", + ), + "gid6=2+1000|\ + gid3=1+1000|\ + gid1=0+1000" + ); +} + #[test] fn fuzzer_001() { assert_eq!( diff --git a/tests/shaping/macos.rs b/tests/shaping/macos.rs index 7f4a1a1c..8c8e184f 100644 --- a/tests/shaping/macos.rs +++ b/tests/shaping/macos.rs @@ -2347,7 +2347,7 @@ fn macos_121() { #[cfg(target_os = "macos")] #[test] -fn macos_122() { +fn macos_123() { assert_eq!( shape( "/System/Library/Fonts/Supplemental/Malayalam MN.ttc", @@ -2359,4 +2359,3 @@ fn macos_122() { C=2+1589" ); } - diff --git a/tests/shaping/main.rs b/tests/shaping/main.rs index 462d7be8..8918e6f5 100644 --- a/tests/shaping/main.rs +++ b/tests/shaping/main.rs @@ -3,7 +3,7 @@ mod custom; mod in_house; mod macos; mod text_rendering_tests; -#[cfg(feature="wasm-shaper")] +#[cfg(feature = "wasm-shaper")] mod wasm; use std::str::FromStr;