Filter out meta items when adding CJK-Latin (#2655)

spacing.
This commit is contained in:
Wenzhuo Liu 2023-11-13 19:13:05 +08:00 committed by GitHub
parent 97bb0fbce3
commit e07275163f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -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 {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,6 @@
// https://github.com/typst/typst/issues/2650
#let with-locate(body) = locate(loc => body)
测a试
#with-locate[a]