Center route-D paragraphs and preview center blocks
This commit is contained in:
1 parent
611e6fec96
commit
472f778e75
5 files changed
+56
-3
No files matched your search
@@ -42,6 +42,9 @@ pub struct ParagraphStyle {
|
||||
pub left_skip: i64,
|
||||
/// Right skip reserved at the end of every line (`\rightskip`).
|
||||
pub right_skip: i64,
|
||||
/// Center each line in the measure instead of justifying it.
|
||||
#[serde(default)]
|
||||
pub centered: bool,
|
||||
pub par_indent: i64,
|
||||
pub line_height: i64,
|
||||
pub char_width: i64,
|
||||
@@ -56,6 +59,7 @@ impl Default for ParagraphStyle {
|
||||
line_width: 400,
|
||||
left_skip: 0,
|
||||
right_skip: 0,
|
||||
centered: false,
|
||||
par_indent: 0,
|
||||
line_height: 12,
|
||||
char_width: 10,
|
||||
@@ -91,6 +95,8 @@ pub struct Paragraph {
|
||||
pub font: ParagraphFont,
|
||||
#[serde(default)]
|
||||
pub left_skip: i64,
|
||||
#[serde(default)]
|
||||
pub centered: bool,
|
||||
}
|
||||
|
||||
impl Paragraph {
|
||||
@@ -150,6 +156,7 @@ pub fn layout_items(items: &[HorizontalItem], style: &ParagraphStyle) -> Paragra
|
||||
width: 0,
|
||||
font: ParagraphFont::Roman,
|
||||
left_skip: style.left_skip,
|
||||
centered: style.centered,
|
||||
};
|
||||
}
|
||||
let mut breakpoints = vec![0_usize];
|
||||
@@ -326,6 +333,7 @@ pub fn layout_items(items: &[HorizontalItem], style: &ParagraphStyle) -> Paragra
|
||||
lines,
|
||||
font: ParagraphFont::Roman,
|
||||
left_skip: style.left_skip,
|
||||
centered: style.centered,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user