mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a
This commit is contained in:
parent
26045d7fcb
commit
d1b433a3b3
160 changed files with 1427 additions and 1162 deletions
|
@ -43,7 +43,7 @@ pub struct FontTable;
|
|||
|
||||
impl FontTableMethods for FontTable {
|
||||
fn with_buffer(&self, _blk: |*const u8, uint|) {
|
||||
fail!()
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl Drop for FontHandle {
|
|||
assert!(self.face.is_not_null());
|
||||
unsafe {
|
||||
if !FT_Done_Face(self.face).succeeded() {
|
||||
fail!("FT_Done_Face failed");
|
||||
panic!("FT_Done_Face failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,15 +139,15 @@ impl FontHandleMethods for FontHandle {
|
|||
if valid {
|
||||
let weight =(*os2).usWeightClass;
|
||||
match weight {
|
||||
1 | 100..199 => font_weight::Weight100,
|
||||
2 | 200..299 => font_weight::Weight200,
|
||||
3 | 300..399 => font_weight::Weight300,
|
||||
4 | 400..499 => font_weight::Weight400,
|
||||
5 | 500..599 => font_weight::Weight500,
|
||||
6 | 600..699 => font_weight::Weight600,
|
||||
7 | 700..799 => font_weight::Weight700,
|
||||
8 | 800..899 => font_weight::Weight800,
|
||||
9 | 900..999 => font_weight::Weight900,
|
||||
1 | 100...199 => font_weight::Weight100,
|
||||
2 | 200...299 => font_weight::Weight200,
|
||||
3 | 300...399 => font_weight::Weight300,
|
||||
4 | 400...499 => font_weight::Weight400,
|
||||
5 | 500...599 => font_weight::Weight500,
|
||||
6 | 600...699 => font_weight::Weight600,
|
||||
7 | 700...799 => font_weight::Weight700,
|
||||
8 | 800...899 => font_weight::Weight800,
|
||||
9 | 900...999 => font_weight::Weight900,
|
||||
_ => default_weight
|
||||
}
|
||||
} else {
|
||||
|
@ -190,7 +190,6 @@ impl FontHandleMethods for FontHandle {
|
|||
let void_glyph = (*self.face).glyph;
|
||||
let slot: FT_GlyphSlot = mem::transmute(void_glyph);
|
||||
assert!(slot.is_not_null());
|
||||
debug!("metrics: {:?}", (*slot).metrics);
|
||||
let advance = (*slot).metrics.horiAdvance;
|
||||
debug!("h_advance for {} is {}", glyph, advance);
|
||||
let advance = advance as i32;
|
||||
|
@ -255,7 +254,7 @@ impl FontHandleMethods for FontHandle {
|
|||
line_gap: height,
|
||||
};
|
||||
|
||||
debug!("Font metrics (@{:f} pt): {:?}", geometry::to_pt(em_size), metrics);
|
||||
debug!("Font metrics (@{:f} pt): {}", geometry::to_pt(em_size), metrics);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
|
@ -297,4 +296,3 @@ impl<'a> FontHandle {
|
|||
return geometry::from_frac_px(value * x_scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ impl FontContextHandle {
|
|||
let mut ctx: FT_Library = ptr::null_mut();
|
||||
|
||||
let result = FT_New_Library(ptr as FT_Memory, &mut ctx);
|
||||
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
|
||||
if !result.succeeded() { panic!("Unable to initialize FreeType library"); }
|
||||
|
||||
FT_Add_Default_Modules(ctx);
|
||||
|
||||
|
|
|
@ -75,13 +75,13 @@ pub fn get_variations_for_family(family_name: &str, callback: |String|) {
|
|||
let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut i8, 0, &mut file) == FcResultMatch {
|
||||
string::raw::from_buf(file as *const i8 as *const u8)
|
||||
} else {
|
||||
fail!();
|
||||
panic!();
|
||||
};
|
||||
let mut index: libc::c_int = 0;
|
||||
let index = if FcPatternGetInteger(*font, FC_INDEX.as_ptr() as *mut i8, 0, &mut index) == FcResultMatch {
|
||||
index
|
||||
} else {
|
||||
fail!();
|
||||
panic!();
|
||||
};
|
||||
|
||||
debug!("variation file: {}", file);
|
||||
|
|
|
@ -178,7 +178,7 @@ impl FontHandleMethods for FontHandle {
|
|||
average_advance: average_advance,
|
||||
line_gap: Au::from_frac_px(line_gap),
|
||||
};
|
||||
debug!("Font metrics (@{:f} pt): {:?}", self.ctfont.pt_size() as f64, metrics);
|
||||
debug!("Font metrics (@{:f} pt): {}", self.ctfont.pt_size() as f64, metrics);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,15 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
pub use platform::freetype::{font, font_context, font_list, font_template};
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
pub use platform::macos::{font, font_context, font_list, font_template};
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os="android")]
|
||||
#[cfg(any(target_os="linux", target_os = "android"))]
|
||||
pub mod freetype {
|
||||
pub mod font;
|
||||
pub mod font_context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue