Add inline box raise and makebox alignment

This commit is contained in:
gloamxun committed 2026-10-19 12:58:21 +08:00
1 parent 337eaa1778
commit 32b0064e5f
11 files changed
+425 -73

No files matched your search

+18 -1
View File
@@ -187,10 +187,25 @@ pub enum UnresolvedReference {
Citation(Vec<String>),
}
/// An unbreakable inline box such as `\mbox{...}` or `\makebox{...}`.
/// Horizontal alignment of a fixed-width inline box.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub enum InlineBoxAlign {
#[default]
Left,
Center,
Right,
}
/// An unbreakable inline box such as `\mbox{...}`, `\makebox{...}`,
/// `\raisebox{...}`, or `\fbox{...}`.
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct InlineBox {
pub runs: Vec<Run>,
/// Fixed width from `\makebox[width]{...}`, if any.
pub width: Option<common::Scaled>,
pub align: InlineBoxAlign,
/// Vertical lift from `\raisebox{lift}{...}`.
pub raise: common::Scaled,
}
/// A filled rectangle produced by `\rule`.
@@ -215,6 +230,7 @@ pub struct Run {
pub penalty: Option<i32>,
pub rule: Option<RuleBox>,
pub box_run: Option<InlineBox>,
pub y_offset: Option<common::Scaled>,
pub unresolved_reference: Option<UnresolvedReference>,
pub bold: bool,
pub italic: bool,
@@ -235,6 +251,7 @@ impl Run {
penalty: None,
rule: None,
box_run: None,
y_offset: None,
unresolved_reference: None,
bold: false,
italic: false,