mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Untry
This commit is contained in:
parent
7af5a7fd54
commit
316cd35767
34 changed files with 261 additions and 264 deletions
|
@ -235,9 +235,9 @@ impl FontList {
|
|||
|
||||
|
||||
fn load_file(path: &str) -> Result<String, io::Error> {
|
||||
let mut file = try!(File::open(path));
|
||||
let mut file = File::open(path)?;
|
||||
let mut content = String::new();
|
||||
try!(file.read_to_string(&mut content));
|
||||
file.read_to_string(&mut content)?;
|
||||
|
||||
Ok(content)
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ impl FontHandleMethods for FontHandle {
|
|||
return Err(());
|
||||
}
|
||||
if let Some(s) = pt_size {
|
||||
try!(FontHandle::set_char_size(face, s).or(Err(())))
|
||||
FontHandle::set_char_size(face, s).or(Err(()))?
|
||||
}
|
||||
Ok(face)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ impl FontTemplateData {
|
|||
},
|
||||
None => {
|
||||
// TODO: Handle file load failure!
|
||||
let mut file = try!(File::open(&*identifier));
|
||||
let mut file = File::open(&*identifier)?;
|
||||
let mut buffer = vec![];
|
||||
file.read_to_end(&mut buffer).unwrap();
|
||||
buffer
|
||||
|
|
|
@ -47,7 +47,7 @@ fn make_tag(tag_bytes: &[u8]) -> FontTableTag {
|
|||
unsafe { *(tag_bytes.as_ptr() as *const FontTableTag) }
|
||||
}
|
||||
|
||||
macro_rules! try_lossy(($result:expr) => (try!($result.map_err(|_| (())))));
|
||||
macro_rules! try_lossy(($result:expr) => ($result.map_err(|_| (()))?));
|
||||
|
||||
// Given a set of records, figure out the string indices for the family and face
|
||||
// names. We want name_id 1 and 2, and we need to use platform_id == 1 and
|
||||
|
@ -262,12 +262,12 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
|
||||
let face = font_file.unwrap().create_face(0, dwrote::DWRITE_FONT_SIMULATIONS_NONE);
|
||||
let info = try!(FontInfo::new_from_face(&face));
|
||||
let info = FontInfo::new_from_face(&face)?;
|
||||
(info, face)
|
||||
} else {
|
||||
let font = font_from_atom(&template.identifier);
|
||||
let face = font.create_font_face();
|
||||
let info = try!(FontInfo::new_from_font(&font));
|
||||
let info = FontInfo::new_from_font(&font)?;
|
||||
(info, face)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue