summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLaurenz Mädje <laurmaedje@gmail.com>2019-07-28 21:03:33 +0200
committerLaurenz Mädje <laurmaedje@gmail.com>2019-07-28 21:03:33 +0200
commit19be053cc3465229a39a65cab2460ac61e18cd8c (patch)
treede130d294f54000f7db04becdb94fc992699aa21 /src/bin
parent6c8b5caa9fa731f16b2d9d232177c00de8f2b74b (diff)
Create some benchmarks 📊
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/main.rs21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs
index 61237580..7ba61645 100644
--- a/src/bin/main.rs
+++ b/src/bin/main.rs
@@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
use std::process;
use typeset::Typesetter;
-use typeset::{font::FileSystemFontProvider, font};
+use typeset::font::FileSystemFontProvider;
use typeset::export::pdf::PdfExporter;
@@ -18,7 +18,7 @@ fn main() {
}
/// The actual main function.
-fn run() -> Result<(), Box<Error>> {
+fn run() -> Result<(), Box<dyn Error>> {
let args: Vec<String> = env::args().collect();
if args.len() < 2 || args.len() > 3 {
help_and_quit();
@@ -45,21 +45,8 @@ fn run() -> Result<(), Box<Error>> {
// Create a typesetter with a font provider that provides the default fonts.
let mut typesetter = Typesetter::new();
- typesetter.add_font_provider(FileSystemFontProvider::new("../fonts", vec![
- ("CMU-SansSerif-Regular.ttf", font!["Computer Modern", Regular, SansSerif]),
- ("CMU-SansSerif-Italic.ttf", font!["Computer Modern", Italic, SansSerif]),
- ("CMU-SansSerif-Bold.ttf", font!["Computer Modern", Bold, SansSerif]),
- ("CMU-SansSerif-Bold-Italic.ttf", font!["Computer Modern", Bold, Italic, SansSerif]),
- ("CMU-Serif-Regular.ttf", font!["Computer Modern", Regular, Serif]),
- ("CMU-Serif-Italic.ttf", font!["Computer Modern", Italic, Serif]),
- ("CMU-Serif-Bold.ttf", font!["Computer Modern", Bold, Serif]),
- ("CMU-Serif-Bold-Italic.ttf", font!["Computer Modern", Bold, Italic, Serif]),
- ("CMU-Typewriter-Regular.ttf", font!["Computer Modern", Regular, Serif, SansSerif, Monospace]),
- ("CMU-Typewriter-Italic.ttf", font!["Computer Modern", Italic, Serif, SansSerif, Monospace]),
- ("CMU-Typewriter-Bold.ttf", font!["Computer Modern", Bold, Serif, SansSerif, Monospace]),
- ("CMU-Typewriter-Bold-Italic.ttf", font!["Computer Modern", Bold, Italic, Serif, SansSerif, Monospace]),
- ("NotoEmoji-Regular.ttf", font!["Noto", Regular, Bold, Italic, SansSerif, Serif, Monospace]),
- ]));
+ let provider = FileSystemFontProvider::from_listing("fonts/fonts.toml").unwrap();
+ typesetter.add_font_provider(provider);
// Typeset the source code.
let document = typesetter.typeset(&src)?;