Honour raggedright and raggedleft paragraph alignment

This commit is contained in:
gloamxun committed 2026-10-19 14:16:50 +08:00
1 parent c7b7660049
commit 2c8d5e12d8
13 files changed
+238 -40

No files matched your search

+12
View File
@@ -314,6 +314,15 @@ pub struct RuleBox {
pub height: common::Scaled,
}
/// Paragraph-level alignment requested by `\raggedright` or `\raggedleft`.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub enum ParagraphAlignment {
#[default]
Justified,
RaggedRight,
RaggedLeft,
}
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct Run {
pub text: String,
@@ -333,6 +342,8 @@ pub struct Run {
pub small_caps: bool,
/// True for the synthetic kern that carries paragraph indentation.
pub paragraph_indent: bool,
/// Alignment declaration active when this run started its paragraph.
pub alignment: Option<ParagraphAlignment>,
}
impl Run {
@@ -354,6 +365,7 @@ impl Run {
sans: false,
small_caps: false,
paragraph_indent: false,
alignment: None,
}
}
}