From a562541fda59e6ba310560e9fe75cc5de71d91dd Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 13 Feb 2019 18:32:42 +0100 Subject: =?UTF-8?q?Refactor=20pdf=20writer=20into=20modular=20crate=20?= =?UTF-8?q?=F0=9F=A7=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/doc.rs | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/doc.rs') diff --git a/src/doc.rs b/src/doc.rs index 04e214a3..66aed533 100644 --- a/src/doc.rs +++ b/src/doc.rs @@ -3,6 +3,7 @@ use std::fmt; use crate::parsing::{SyntaxTree, Node}; use crate::font::{Font, BuiltinFont}; +use pdf::Size; /// Abstract representation of a complete typesetted document. @@ -48,35 +49,6 @@ pub enum DocumentFont { Loaded(Font), } -/// A distance that can be created from different units of length. -#[derive(Debug, Copy, Clone, PartialEq)] -pub struct Size { - /// The size in typographic points (1/72 inches). - pub points: f32, -} - -impl Size { - /// Create a size from a number of points. - pub fn from_points(points: f32) -> Size { - Size { points } - } - - /// Create a size from a number of inches. - pub fn from_inches(inches: f32) -> Size { - Size { points: inches / 72.0 } - } - - /// Create a size from a number of millimeters. - pub fn from_mm(mm: f32) -> Size { - Size { points: 2.8345 * mm } - } - - /// Create a size from a number of centimeters. - pub fn from_cm(cm: f32) -> Size { - Size { points: 0.028345 * cm } - } -} - /// A type that can be generated into a document. pub trait Generate { -- cgit v1.2.3