From b3734bbc046fe7b14cff54e2dae7014a71014777 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 24 May 2019 12:24:10 +0200 Subject: =?UTF-8?q?Restructure=20engine=20into=20modular=20layouter=20?= =?UTF-8?q?=F0=9F=8D=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/main.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/bin') diff --git a/src/bin/main.rs b/src/bin/main.rs index b548214a..9e1403b2 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -5,7 +5,7 @@ use std::process; use std::io::Read; use std::path::{Path, PathBuf}; -use typeset::Compiler; +use typeset::Typesetter; use typeset::{font::FileSystemFontProvider, font_info}; use typeset::export::pdf::PdfExporter; @@ -33,10 +33,10 @@ fn run() -> Result<(), Box> { let mut src = String::new(); file.read_to_string(&mut src).map_err(|_| "failed to read from source file")?; - // Create a compiler with a font provider that provides three fonts + // Create a typesetter with a font provider that provides three fonts // (two sans-serif fonts and a fallback for the emoji). - let mut compiler = Compiler::new(); - compiler.add_font_provider(FileSystemFontProvider::new("fonts", vec![ + let mut typesetter = Typesetter::new(); + typesetter.add_font_provider(FileSystemFontProvider::new("fonts", vec![ ("NotoSans-Regular.ttf", font_info!(["NotoSans", "Noto", SansSerif])), ("NotoSans-Italic.ttf", font_info!(["NotoSans", "Noto", SansSerif], italic)), ("NotoSans-Bold.ttf", font_info!(["NotoSans", "Noto", SansSerif], bold)), @@ -45,9 +45,8 @@ fn run() -> Result<(), Box> { ("NotoEmoji-Regular.ttf", font_info!(["NotoEmoji", "Noto", SansSerif, Serif, Monospace])), ])); - // Compile the source code with the compiler. - let document = compiler.compile(&src)?; - + // Typeset the source code. + let document = typesetter.typeset(&src)?; // Export the document into a PDF file. let exporter = PdfExporter::new(); -- cgit v1.2.3