diff options
author | Josh Matthews <josh@joshmatthews.net> | 2016-07-01 11:26:32 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2016-07-05 10:02:40 -0400 |
commit | fb943ab54bfe8d1a58de965502a95497e3c621f0 (patch) | |
tree | cea42f5e2b5cc072dc4f42b40bf02dd0eb0e91fb /components/gfx/platform/macos | |
parent | 0ae07e07e6c75e630ba0a5eaf95fa1046c6737c2 (diff) | |
download | servo-fb943ab54bfe8d1a58de965502a95497e3c621f0.tar.gz servo-fb943ab54bfe8d1a58de965502a95497e3c621f0.zip |
Make font template data load fallible. Fixes #12037.
Diffstat (limited to 'components/gfx/platform/macos')
-rw-r--r-- | components/gfx/platform/macos/font_template.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/components/gfx/platform/macos/font_template.rs b/components/gfx/platform/macos/font_template.rs index a36b49eebe3..81b8a07aeed 100644 --- a/components/gfx/platform/macos/font_template.rs +++ b/components/gfx/platform/macos/font_template.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::borrow::ToOwned; use std::collections::HashMap; use std::fs::File; -use std::io::Read; +use std::io::{Read, Error as IoError}; use std::ops::Deref; use std::sync::Mutex; use string_cache::Atom; @@ -41,12 +41,12 @@ unsafe impl Send for FontTemplateData {} unsafe impl Sync for FontTemplateData {} impl FontTemplateData { - pub fn new(identifier: Atom, font_data: Option<Vec<u8>>) -> FontTemplateData { - FontTemplateData { + pub fn new(identifier: Atom, font_data: Option<Vec<u8>>) -> Result<FontTemplateData, IoError> { + Ok(FontTemplateData { ctfont: CachedCTFont(Mutex::new(HashMap::new())), identifier: identifier.to_owned(), font_data: font_data - } + }) } /// Retrieves the Core Text font instance, instantiating it if necessary. |