diff --git a/crates/typst/src/layout/inline/mod.rs b/crates/typst/src/layout/inline/mod.rs index 3587c250b..fd1e60db9 100644 --- a/crates/typst/src/layout/inline/mod.rs +++ b/crates/typst/src/layout/inline/mod.rs @@ -450,10 +450,10 @@ fn collect<'a>( let prev = full.len(); let dir = TextElem::dir_in(styles); if dir != outer_dir { - // Insert "Explicit Directional Isolate". + // Insert "Explicit Directional Embedding". match dir { - Dir::LTR => full.push('\u{2066}'), - Dir::RTL => full.push('\u{2067}'), + Dir::LTR => full.push('\u{202A}'), + Dir::RTL => full.push('\u{202B}'), _ => {} } } @@ -465,8 +465,8 @@ fn collect<'a>( } if dir != outer_dir { - // Insert "Pop Directional Isolate". - full.push('\u{2069}'); + // Insert "Pop Directional Formatting". + full.push('\u{202C}'); } Segment::Text(full.len() - prev) } else if let Some(elem) = child.to_packed::() { diff --git a/crates/typst/src/text/raw.rs b/crates/typst/src/text/raw.rs index f0105363f..dc288a662 100644 --- a/crates/typst/src/text/raw.rs +++ b/crates/typst/src/text/raw.rs @@ -443,6 +443,7 @@ impl ShowSet for Packed { fn show_set(&self, styles: StyleChain) -> Styles { let mut out = Styles::new(); out.set(TextElem::set_overhang(false)); + out.set(TextElem::set_lang(Lang::ENGLISH)); out.set(TextElem::set_hyphenate(Hyphenate(Smart::Custom(false)))); out.set(TextElem::set_size(TextSize(Em::new(0.8).into()))); out.set(TextElem::set_font(FontList(vec![FontFamily::new("DejaVu Sans Mono")]))); diff --git a/tests/ref/layout/par-bidi.png b/tests/ref/layout/par-bidi.png index 4750ccb88..af66a719f 100644 Binary files a/tests/ref/layout/par-bidi.png and b/tests/ref/layout/par-bidi.png differ diff --git a/tests/typ/layout/par-bidi.typ b/tests/typ/layout/par-bidi.typ index edbd75e16..4ff83802b 100644 --- a/tests/typ/layout/par-bidi.typ +++ b/tests/typ/layout/par-bidi.typ @@ -54,6 +54,16 @@ Lריווח #h(1cm) R #linebreak() ב #text("12:00 - 13:00",dir:ltr) בצהריים +--- +// Mixing raw +#set text(lang: "he") +לדוג. `if a == b:` זה תנאי +#set raw(lang:"python") +לדוג. `if a == b:` זה תנאי + +#show raw: set text(dir:rtl) +לתכנת בעברית `אם א == ב:` + --- // Test setting a vertical direction. // Ref: false