Fix compression of punctuation marks at line start of end (#3744)

This commit is contained in:
Ran Luo 2024-04-02 04:22:00 +08:00 committed by Laurenz
parent cdd8d167cf
commit 2c6b69ff6d
3 changed files with 13 additions and 2 deletions

View File

@ -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;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -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 行首行尾禁则时,就需要对标点符号的宽度进行调整。是否调整取决于……