summaryrefslogtreecommitdiff
path: root/src/doc.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-02-16 18:57:50 +0100
committerLaurenz <laurmaedje@gmail.com>2019-02-16 20:17:31 +0100
commitae3af533ffba9e3bb3719eafb4e6339f0e23c1f0 (patch)
treebe0bf6339ea27a6fc845d1a2266d43e56a74fd33 /src/doc.rs
parentf3f82f5f2b35f70d2cad934448c7e159aed2a3df (diff)
Extract opentype parser into crate 🧱
Diffstat (limited to 'src/doc.rs')
-rw-r--r--src/doc.rs17
1 files changed, 0 insertions, 17 deletions
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<Page>,
- /// The fonts used by the document.
- pub fonts: Vec<DocumentFont>,
}
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<Document> {
- 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)],
});
}
}