aboutsummaryrefslogtreecommitdiff
path: root/src/renderer
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-31 11:17:02 -0800
committerJoe Wilm <joe@jwilm.com>2016-12-31 20:47:02 -0800
commit2738969f292c5202800f61d4f073d82aef436836 (patch)
tree55b4a75b2c39284e1fbd1b52f172d0752e820a6a /src/renderer
parenta00970c9a83d0a9033e70650beb2f4a924cfe9cc (diff)
downloadalacritty-2738969f292c5202800f61d4f073d82aef436836.tar.gz
alacritty-2738969f292c5202800f61d4f073d82aef436836.zip
Propagate font rasterizer errors
This allows consumers of the font crate to handle errors instead of the library panicking.
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/mod.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index 54db4851..838555b8 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -20,7 +20,7 @@ use std::ptr;
use std::sync::mpsc;
use cgmath;
-use font::{self, Rasterizer, RasterizedGlyph, FontDesc, GlyphKey, FontKey};
+use font::{self, Rasterizer, Rasterize, RasterizedGlyph, FontDesc, GlyphKey, FontKey};
use gl::types::*;
use gl;
use notify::{Watcher as WatcherApi, RecommendedWatcher as Watcher, op};
@@ -138,7 +138,7 @@ impl GlyphCache {
let bold = if bold_desc == regular_desc {
regular
} else {
- rasterizer.load_font(&bold_desc, size).unwrap_or_else(|| regular)
+ rasterizer.load_font(&bold_desc, size).unwrap_or_else(|_| regular)
};
// Load italic font
@@ -149,7 +149,7 @@ impl GlyphCache {
regular
} else {
rasterizer.load_font(&italic_desc, size)
- .unwrap_or_else(|| regular)
+ .unwrap_or_else(|_| regular)
};
let mut cache = GlyphCache {
@@ -181,13 +181,15 @@ impl GlyphCache {
}
pub fn font_metrics(&self) -> font::Metrics {
- self.rasterizer.metrics(self.font_key, self.font_size)
+ // TODO ERROR HANDLING
+ self.rasterizer.metrics(self.font_key, self.font_size).unwrap()
}
fn load_and_cache_glyph<L>(&mut self, glyph_key: GlyphKey, loader: &mut L)
where L: LoadGlyph
{
- let rasterized = self.rasterizer.get_glyph(&glyph_key);
+ // TODO ERROR HANDLING
+ let rasterized = self.rasterizer.get_glyph(&glyph_key).unwrap();
let glyph = loader.load_glyph(&rasterized);
self.cache.insert(glyph_key, glyph);
}