From ae3af533ffba9e3bb3719eafb4e6339f0e23c1f0 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 16 Feb 2019 18:57:50 +0100 Subject: =?UTF-8?q?Extract=20opentype=20parser=20into=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 | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src/doc.rs') diff --git a/src/doc.rs b/src/doc.rs index 66aed533..cc44ca7d 100644 --- a/src/doc.rs +++ b/src/doc.rs @@ -2,7 +2,6 @@ use std::fmt; use crate::parsing::{SyntaxTree, Node}; -use crate::font::{Font, BuiltinFont}; use pdf::Size; @@ -13,8 +12,6 @@ use pdf::Size; pub struct Document { /// The pages of the document. pub pages: Vec, - /// The fonts used by the document. - pub fonts: Vec, } impl Document { @@ -22,7 +19,6 @@ impl Document { pub fn new() -> Document { Document { pages: vec![], - fonts: vec![], } } } @@ -40,15 +36,6 @@ pub struct Page { #[derive(Debug, Clone, Eq, PartialEq)] pub struct Text(pub String); -/// A font (either built-in or external). -#[derive(Debug, Clone, PartialEq)] -pub enum DocumentFont { - /// One of the 14 built-in fonts. - Builtin(BuiltinFont), - /// An externally loaded font. - Loaded(Font), -} - /// A type that can be generated into a document. pub trait Generate { @@ -93,8 +80,6 @@ impl<'s> Generator<'s> { /// Generate the abstract document. fn generate(&mut self) -> GenResult { - let fonts = vec![DocumentFont::Builtin(BuiltinFont::Helvetica)]; - let mut text = String::new(); for node in &self.tree.nodes { match node { @@ -115,7 +100,6 @@ impl<'s> Generator<'s> { Ok(Document { pages: vec![page], - fonts, }) } @@ -153,7 +137,6 @@ mod generator_tests { ] } ], - fonts: vec![DocumentFont::Builtin(BuiltinFont::Helvetica)], }); } } -- cgit v1.2.3