summaryrefslogtreecommitdiff
path: root/src/doc.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-02-13 18:32:42 +0100
committerLaurenz <laurmaedje@gmail.com>2019-02-13 18:32:42 +0100
commita562541fda59e6ba310560e9fe75cc5de71d91dd (patch)
tree9bfc09f7701d5cdfa04d3b5b29d838d666cb904d /src/doc.rs
parent5a600eb354c65ec008cbf020e45705c2f401d669 (diff)
Refactor pdf writer into modular crate 🧱
Diffstat (limited to 'src/doc.rs')
-rw-r--r--src/doc.rs30
1 files changed, 1 insertions, 29 deletions
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 {