diff --git a/crates/typst-library/src/layout/par.rs b/crates/typst-library/src/layout/par.rs index b3d5fb3ed..98cf605f7 100644 --- a/crates/typst-library/src/layout/par.rs +++ b/crates/typst-library/src/layout/par.rs @@ -751,7 +751,7 @@ fn prepare<'a>( /// See Requirements for Chinese Text Layout, Section 3.2.2 Mixed Text Composition in Horizontal /// Written Mode fn add_cjk_latin_spacing(items: &mut [Item]) { - let mut items = items.iter_mut().peekable(); + let mut items = items.iter_mut().filter(|x| !matches!(x, Item::Meta(_))).peekable(); let mut prev: Option<&ShapedGlyph> = None; while let Some(item) = items.next() { let Some(text) = item.text_mut() else { diff --git a/tests/ref/bugs/2650-cjk-latin-spacing-meta.png b/tests/ref/bugs/2650-cjk-latin-spacing-meta.png new file mode 100644 index 000000000..35ff0e62d Binary files /dev/null and b/tests/ref/bugs/2650-cjk-latin-spacing-meta.png differ diff --git a/tests/typ/bugs/2650-cjk-latin-spacing-meta.typ b/tests/typ/bugs/2650-cjk-latin-spacing-meta.typ new file mode 100644 index 000000000..e234e6515 --- /dev/null +++ b/tests/typ/bugs/2650-cjk-latin-spacing-meta.typ @@ -0,0 +1,6 @@ +// https://github.com/typst/typst/issues/2650 +#let with-locate(body) = locate(loc => body) + +测a试 + +测#with-locate[a]试