mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Make font template data load fallible. Fixes #12037.
This commit is contained in:
parent
0ae07e07e6
commit
fb943ab54b
4 changed files with 29 additions and 25 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue