mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Remove PageState::new
This commit is contained in:
parent
c97b3078eb
commit
88d3be2581
@ -5,7 +5,7 @@ use crate::color::{Color, RgbaColor};
|
|||||||
use crate::font::{FontStretch, FontStyle, FontVariant, FontWeight, VerticalFontMetric};
|
use crate::font::{FontStretch, FontStyle, FontVariant, FontWeight, VerticalFontMetric};
|
||||||
use crate::geom::*;
|
use crate::geom::*;
|
||||||
use crate::layout::Paint;
|
use crate::layout::Paint;
|
||||||
use crate::paper::{Paper, PaperClass, PAPER_A4};
|
use crate::paper::{PaperClass, PAPER_A4};
|
||||||
|
|
||||||
/// The execution state.
|
/// The execution state.
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
@ -51,16 +51,7 @@ pub struct PageState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PageState {
|
impl PageState {
|
||||||
/// The default page style for the given paper.
|
/// The resolved margins.
|
||||||
pub fn new(paper: Paper) -> Self {
|
|
||||||
Self {
|
|
||||||
class: paper.class,
|
|
||||||
size: paper.size(),
|
|
||||||
margins: Sides::splat(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The margins.
|
|
||||||
pub fn margins(&self) -> Sides<Linear> {
|
pub fn margins(&self) -> Sides<Linear> {
|
||||||
let default = self.class.default_margins();
|
let default = self.class.default_margins();
|
||||||
Sides {
|
Sides {
|
||||||
@ -74,7 +65,12 @@ impl PageState {
|
|||||||
|
|
||||||
impl Default for PageState {
|
impl Default for PageState {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new(PAPER_A4)
|
let paper = PAPER_A4;
|
||||||
|
Self {
|
||||||
|
class: paper.class,
|
||||||
|
size: paper.size(),
|
||||||
|
margins: Sides::splat(None),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user