summaryrefslogtreecommitdiff
path: root/src/style.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-06-21 21:37:29 +0200
committerLaurenz <laurmaedje@gmail.com>2019-06-21 21:41:02 +0200
commit968e121697a96a2e3b05a560176c34f4bb6693c3 (patch)
treeb937cf208d7a8bfb318227a46e44f91da4ef7a49 /src/style.rs
parentb53ad6b1ec8b2fd05566a83c9b895f265e61d281 (diff)
Implement flex and box layouting 📏
Diffstat (limited to 'src/style.rs')
-rw-r--r--src/style.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/style.rs b/src/style.rs
index c4e92ec9..97f9552c 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -9,6 +9,10 @@ use crate::size::{Size, Size2D, SizeBox};
pub struct TextStyle {
/// A fallback list of font families to use.
pub font_families: Vec<FontFamily>,
+ /// Whether the font is in italics.
+ pub italic: bool,
+ /// Whether the font is bold.
+ pub bold: bool,
/// The font size.
pub font_size: f32,
/// The line spacing (as a multiple of the font size).
@@ -22,7 +26,9 @@ impl Default for TextStyle {
use FontFamily::*;
TextStyle {
// Default font family, font size and line spacing.
- font_families: vec![SansSerif, Serif, Monospace],
+ font_families: vec![Serif, SansSerif, Monospace],
+ italic: false,
+ bold: false,
font_size: 11.0,
line_spacing: 1.25,
paragraph_spacing: 1.5,
@@ -44,16 +50,16 @@ impl Default for PageStyle {
PageStyle {
// A4 paper.
dimensions: Size2D {
- x: Size::from_mm(210.0),
- y: Size::from_mm(297.0),
+ x: Size::mm(210.0),
+ y: Size::mm(297.0),
},
// All the same margins.
margins: SizeBox {
- left: Size::from_cm(3.0),
- top: Size::from_cm(3.0),
- right: Size::from_cm(3.0),
- bottom: Size::from_cm(3.0),
+ left: Size::cm(2.5),
+ top: Size::cm(2.5),
+ right: Size::cm(2.5),
+ bottom: Size::cm(2.5),
},
}
}