summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-25 23:41:04 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-25 23:41:04 +0200
commit88d3be258114d631f6e1381e756ff9bb8aba6b0e (patch)
tree143fac2cb0e50e3781c944e8a69c60db1d653fac /src
parentc97b3078eb39995528302100d4e8b60c032cadd3 (diff)
Remove PageState::new
Diffstat (limited to 'src')
-rw-r--r--src/exec/state.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/exec/state.rs b/src/exec/state.rs
index be70cb67..0145f60f 100644
--- a/src/exec/state.rs
+++ b/src/exec/state.rs
@@ -5,7 +5,7 @@ use crate::color::{Color, RgbaColor};
use crate::font::{FontStretch, FontStyle, FontVariant, FontWeight, VerticalFontMetric};
use crate::geom::*;
use crate::layout::Paint;
-use crate::paper::{Paper, PaperClass, PAPER_A4};
+use crate::paper::{PaperClass, PAPER_A4};
/// The execution state.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
@@ -51,16 +51,7 @@ pub struct PageState {
}
impl PageState {
- /// The default page style for the given paper.
- pub fn new(paper: Paper) -> Self {
- Self {
- class: paper.class,
- size: paper.size(),
- margins: Sides::splat(None),
- }
- }
-
- /// The margins.
+ /// The resolved margins.
pub fn margins(&self) -> Sides<Linear> {
let default = self.class.default_margins();
Sides {
@@ -74,7 +65,12 @@ impl PageState {
impl Default for PageState {
fn default() -> Self {
- Self::new(PAPER_A4)
+ let paper = PAPER_A4;
+ Self {
+ class: paper.class,
+ size: paper.size(),
+ margins: Sides::splat(None),
+ }
}
}