summaryrefslogtreecommitdiff
path: root/src/doc.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-03-13 19:13:49 +0100
committerLaurenz <laurmaedje@gmail.com>2019-03-13 19:15:51 +0100
commit89205368c2788842abb13f1c174607d85dc4abe1 (patch)
treedce7fe4cbaf6c2ddeee6aa0d1126bf3fd2db1c95 /src/doc.rs
parent0c87c0c5a5b7379e938ef9f37673f9c9c0bff051 (diff)
Fix space handling for multiline 🔨
Diffstat (limited to 'src/doc.rs')
-rw-r--r--src/doc.rs35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/doc.rs b/src/doc.rs
index 3e060f6e..a3bdfeb6 100644
--- a/src/doc.rs
+++ b/src/doc.rs
@@ -15,10 +15,19 @@ pub struct Document {
/// Default styles for a document.
#[derive(Debug, Clone, PartialEq)]
pub struct Style {
- /// The width and height of the paper.
- pub paper_size: [Size; 2],
- /// The [left, top, right, bottom] margins of the paper.
- pub margins: [Size; 4],
+ /// The width of the paper.
+ pub width: Size,
+ /// The height of the paper.
+ pub height: Size,
+
+ /// The left margin of the paper.
+ pub margin_left: Size,
+ /// The top margin of the paper.
+ pub margin_top: Size,
+ /// The right margin of the paper.
+ pub margin_right: Size,
+ /// The bottom margin of the paper.
+ pub margin_bottom: Size,
/// A fallback list of font families to use.
pub font_families: Vec<String>,
@@ -31,9 +40,15 @@ pub struct Style {
impl Default for Style {
fn default() -> Style {
Style {
- // A4 paper with 1.5 cm margins in all directions
- paper_size: [Size::from_mm(210.0), Size::from_mm(297.0)],
- margins: [Size::from_cm(2.5); 4],
+ // A4 paper
+ width: Size::from_mm(210.0),
+ height: Size::from_mm(297.0),
+
+ // A bit more on top and bottom
+ margin_left: Size::from_cm(2.5),
+ margin_top: Size::from_cm(3.0),
+ margin_right: Size::from_cm(2.5),
+ margin_bottom: Size::from_cm(3.0),
// Default font family
font_families: (&[
@@ -48,8 +63,10 @@ impl Default for Style {
/// A page with text contents in a document.
#[derive(Debug, Clone, PartialEq)]
pub struct Page {
- /// The width and height of the page.
- pub size: [Size; 2],
+ /// The width of the page.
+ pub width: Size,
+ /// The height of the page.
+ pub height: Size,
/// Text content on the page.
pub text: Vec<Text>,
}