summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst-library/src/layout/par.rs2
-rw-r--r--tests/ref/bugs/2650-cjk-latin-spacing-meta.pngbin0 -> 1299 bytes
-rw-r--r--tests/typ/bugs/2650-cjk-latin-spacing-meta.typ6
3 files changed, 7 insertions, 1 deletions
diff --git a/crates/typst-library/src/layout/par.rs b/crates/typst-library/src/layout/par.rs
index b3d5fb3e..98cf605f 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 00000000..35ff0e62
--- /dev/null
+++ b/tests/ref/bugs/2650-cjk-latin-spacing-meta.png
Binary files 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 00000000..e234e651
--- /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]试