Support hang indentation and parshape measures

This commit is contained in:
gloamxun committed 2026-10-23 01:18:19 +08:00
1 parent 24a96d1c7c
commit 8993186005
7 files changed
+269 -88

No files matched your search

+5 -4
View File
@@ -409,7 +409,8 @@ impl Page {
let lines = paragraph.lines.len().max(1) as i64;
let line_height = (paragraph.height / lines).max(1);
let size = 10 * 65_536;
for line in &paragraph.lines {
for (line_index, line) in paragraph.lines.iter().enumerate() {
let indent = paragraph.line_indents.get(line_index).copied().unwrap_or(0);
let baseline = y + ((line_height as f64) * 0.8) as i64;
let natural: i64 = line
.iter()
@@ -421,11 +422,11 @@ impl Page {
})
.sum();
let mut x = if paragraph.centered {
paragraph.left_skip + ((paragraph.width - natural) / 2).max(0)
paragraph.left_skip + indent + ((paragraph.width - natural) / 2).max(0)
} else if paragraph.right_aligned {
paragraph.left_skip + (paragraph.width - natural).max(0)
paragraph.left_skip + indent + (paragraph.width - natural).max(0)
} else {
paragraph.left_skip
paragraph.left_skip + indent
};
for item in line {
match item {