diff options
| -rw-r--r-- | crates/typst/src/layout/inline/mod.rs | 10 | ||||
| -rw-r--r-- | crates/typst/src/text/raw.rs | 1 | ||||
| -rw-r--r-- | tests/ref/layout/par-bidi.png | bin | 25731 -> 31441 bytes | |||
| -rw-r--r-- | tests/typ/layout/par-bidi.typ | 10 |
4 files changed, 16 insertions, 5 deletions
diff --git a/crates/typst/src/layout/inline/mod.rs b/crates/typst/src/layout/inline/mod.rs index 3587c250..fd1e60db 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::<HElem>() { diff --git a/crates/typst/src/text/raw.rs b/crates/typst/src/text/raw.rs index f0105363..dc288a66 100644 --- a/crates/typst/src/text/raw.rs +++ b/crates/typst/src/text/raw.rs @@ -443,6 +443,7 @@ impl ShowSet for Packed<RawElem> { 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 Binary files differindex 4750ccb8..af66a719 100644 --- a/tests/ref/layout/par-bidi.png +++ b/tests/ref/layout/par-bidi.png diff --git a/tests/typ/layout/par-bidi.typ b/tests/typ/layout/par-bidi.typ index edbd75e1..4ff83802 100644 --- a/tests/typ/layout/par-bidi.typ +++ b/tests/typ/layout/par-bidi.typ @@ -55,6 +55,16 @@ Lריווח #h(1cm) R ב #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 |
