Add paragraph indentation and hfill

This commit is contained in:
gloamxun committed 2026-10-19 12:43:30 +08:00
1 parent bad477fbee
commit e44d4c8669
11 files changed
+362 -42

No files matched your search

+24 -1
View File
@@ -55,12 +55,13 @@ impl Default for PageSize {
}
}
#[derive(Clone, Default)]
#[derive(Clone)]
pub struct DocumentModel {
pub title: String,
pub author: String,
pub date: String,
pub page: PageSize,
pub parindent: common::Scaled,
pub margins: PageMargins,
pub show_title: bool,
pub blocks: Vec<Block>,
@@ -69,6 +70,25 @@ pub struct DocumentModel {
pub citations: HashMap<String, usize>,
}
impl Default for DocumentModel {
fn default() -> Self {
Self {
title: String::new(),
author: String::new(),
date: String::new(),
page: PageSize::default(),
// article's default \parindent for 10/11pt text.
parindent: common::Scaled(17 * 65_536),
margins: PageMargins::default(),
show_title: false,
blocks: Vec::new(),
block_sources: Vec::new(),
labels: HashMap::new(),
citations: HashMap::new(),
}
}
}
pub struct ParsedDocument(pub DocumentModel);
#[derive(Clone)]
@@ -199,6 +219,8 @@ pub struct Run {
pub bold: bool,
pub italic: bool,
pub monospace: bool,
/// True for the synthetic kern that carries paragraph indentation.
pub paragraph_indent: bool,
}
impl Run {
@@ -215,6 +237,7 @@ impl Run {
bold: false,
italic: false,
monospace: false,
paragraph_indent: false,
}
}
}