diff --git a/crates/typst/src/layout/inline/shaping.rs b/crates/typst/src/layout/inline/shaping.rs index c346233e3..82a33f9b0 100644 --- a/crates/typst/src/layout/inline/shaping.rs +++ b/crates/typst/src/layout/inline/shaping.rs @@ -189,14 +189,12 @@ impl ShapedGlyph { self.x_offset -= amount; self.x_advance -= amount; self.adjustability.shrinkability.0 -= amount; - self.adjustability.stretchability.0 += amount; } /// Shrink the width of glyph on the right side. pub fn shrink_right(&mut self, amount: Em) { self.x_advance -= amount; self.adjustability.shrinkability.1 -= amount; - self.adjustability.stretchability.1 += amount; } } diff --git a/tests/ref/layout/par-justify-cjk.png b/tests/ref/layout/par-justify-cjk.png index a9baf14c5..25adfcb25 100644 Binary files a/tests/ref/layout/par-justify-cjk.png and b/tests/ref/layout/par-justify-cjk.png differ diff --git a/tests/typ/layout/par-justify-cjk.typ b/tests/typ/layout/par-justify-cjk.typ index 51c86c7b9..d0fef6446 100644 --- a/tests/typ/layout/par-justify-cjk.typ +++ b/tests/typ/layout/par-justify-cjk.typ @@ -49,3 +49,16 @@ #set text(lang: "zh", region: "hk", font: "Noto Serif CJK TC") 孔雀最早见于《山海经》中的《海内经》:「有孔雀。」东汉杨孚著《异物志》记载,岭南:「孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。」 + +--- +// Test punctuation marks adjustment in justified paragraph. + +// The test case includes the following scenarios: +// - Compression of punctuation marks at line start or line end +// - Adjustment of adjacent punctuation marks + +#set page(width: 110pt + 10pt, margin: (x: 5pt)) +#set text(lang: "zh", font: "Noto Serif CJK SC") +#set par(justify: true) + +标注在字间的标点符号(乙式括号省略号以外)通常占一个汉字宽度,使其易于识别、适合配置及排版,有些排版风格完全不对标点宽度进行任何调整。但是为了让文字体裁更加紧凑易读,,,以及执行3.1.4 行首行尾禁则时,就需要对标点符号的宽度进行调整。是否调整取决于……