Center route-D paragraphs and preview center blocks

This commit is contained in:
gloamxun committed 2026-10-20 22:12:39 +08:00
1 parent 611e6fec96
commit 472f778e75
5 files changed
+56 -3

No files matched your search

+8
View File
@@ -78,6 +78,7 @@ pub fn edit_json(source: &str, unit: usize) -> Result<String, String> {
#[derive(Clone)]
struct SourceParagraph {
text: String,
centered: bool,
font: ParagraphFont,
line_height: i64,
math: bool,
@@ -130,6 +131,7 @@ fn parse_blocks(raw: &str) -> Vec<SourceParagraph> {
line_height: 12,
math: false,
left_skip: 12,
centered: false,
}
})
.collect();
@@ -149,6 +151,7 @@ fn parse_blocks(raw: &str) -> Vec<SourceParagraph> {
line_height: 12,
math: false,
left_skip: 12,
centered: false,
}];
}
}
@@ -177,6 +180,7 @@ fn parse_blocks(raw: &str) -> Vec<SourceParagraph> {
line_height: 12,
math: false,
left_skip: 12,
centered: false,
}
})
.collect();
@@ -205,6 +209,7 @@ fn parse_paragraph(raw: &str) -> SourceParagraph {
line_height: 12,
math: true,
left_skip: 0,
centered: false,
};
}
let candidates = [
@@ -220,6 +225,7 @@ fn parse_paragraph(raw: &str) -> SourceParagraph {
line_height,
math: false,
left_skip: 0,
centered: false,
};
}
}
@@ -229,6 +235,7 @@ fn parse_paragraph(raw: &str) -> SourceParagraph {
line_height: 12,
math: false,
left_skip: 0,
centered: false,
}
}
@@ -247,6 +254,7 @@ fn build_document(paragraphs: &[SourceParagraph]) -> Document {
let style = ParagraphStyle {
line_width: 480 * SCALE,
left_skip: paragraph.left_skip * SCALE,
centered: paragraph.centered,
right_skip: 0,
par_indent: 0,
line_height: paragraph.line_height * SCALE,