Right-align route-D paragraphs and preview flushright blocks

This commit is contained in:
gloamxun committed 2026-10-20 22:23:47 +08:00
1 parent 6714591704
commit 40ed26e339
5 files changed
+43 -2

No files matched your search

+8
View File
@@ -79,6 +79,7 @@ pub fn edit_json(source: &str, unit: usize) -> Result<String, String> {
struct SourceParagraph {
text: String,
centered: bool,
right_aligned: bool,
font: ParagraphFont,
line_height: i64,
math: bool,
@@ -132,6 +133,7 @@ fn parse_blocks(raw: &str) -> Vec<SourceParagraph> {
math: false,
left_skip: 12,
centered: false,
right_aligned: false,
}
})
.collect();
@@ -152,6 +154,7 @@ fn parse_blocks(raw: &str) -> Vec<SourceParagraph> {
math: false,
left_skip: 12,
centered: false,
right_aligned: false,
}];
}
}
@@ -181,6 +184,7 @@ fn parse_blocks(raw: &str) -> Vec<SourceParagraph> {
math: false,
left_skip: 12,
centered: false,
right_aligned: false,
}
})
.collect();
@@ -210,6 +214,7 @@ fn parse_paragraph(raw: &str) -> SourceParagraph {
math: true,
left_skip: 0,
centered: false,
right_aligned: false,
};
}
let candidates = [
@@ -226,6 +231,7 @@ fn parse_paragraph(raw: &str) -> SourceParagraph {
math: false,
left_skip: 0,
centered: false,
right_aligned: false,
};
}
}
@@ -236,6 +242,7 @@ fn parse_paragraph(raw: &str) -> SourceParagraph {
math: false,
left_skip: 0,
centered: false,
right_aligned: false,
}
}
@@ -255,6 +262,7 @@ fn build_document(paragraphs: &[SourceParagraph]) -> Document {
line_width: 480 * SCALE,
left_skip: paragraph.left_skip * SCALE,
centered: paragraph.centered,
right_aligned: paragraph.right_aligned,
right_skip: 0,
par_indent: 0,
line_height: paragraph.line_height * SCALE,