fix: find decoration spans in bidi text

This commit is contained in:
Hojjat 2026-02-24 18:39:26 -07:00 committed by Jeremy Soller
parent 0666ba14b1
commit b0884c0ab1
6 changed files with 64 additions and 17 deletions

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7c856de2313bef83d36dd8776dfcba6f6312238d983f97603fc9a76fa53fea2c
size 15386
oid sha256:d83b58ede597fede243ebb042c31668c0847069a3843dc9b279c3624e1387728
size 15146

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e332dc9edc0d8c2fd6dd7d9361dc1441b4c979023e79571ac26b7f4f1f1b274
size 15305

View file

@ -50,7 +50,6 @@ fn test_text_decorations() {
.validate_text_rendering();
}
#[test]
fn test_text_decorations_rtl() {
let base = base_attrs();
@ -125,3 +124,41 @@ fn test_text_decorations_bidi() {
.canvas(600, 50)
.validate_text_rendering();
}
/// Multiline Bidi test
#[test]
fn test_text_decorations_multiline_bidi() {
let base = base_attrs();
let red = Color::rgb(0xFF, 0x00, 0x00);
let cyan = Color::rgb(0x00, 0xFF, 0xFF);
DrawTestCfg::new("text_decoration_multiline_bidi")
.font_size(20., 26.)
.font_attrs(base.clone())
.rich_text(vec![
("زیرخط ", base.clone().underline(UnderlineStyle::Single)),
("Double ", base.clone().underline(UnderlineStyle::Double)),
("خط ", base.clone().strikethrough()),
("Over \n", base.clone().overline()),
(
"Red زیر خط ",
base.clone()
.underline(UnderlineStyle::Single)
.underline_color(red),
),
(
"CyanSt ",
base.clone().strikethrough().strikethrough_color(cyan),
),
(
"All",
base.clone()
.underline(UnderlineStyle::Single)
.strikethrough()
.overline(),
),
(" Plain", base),
])
.canvas(400, 80)
.validate_text_rendering();
}