mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Rename Au methods with f32/f64 instead of frac32/frac/subpx
This commit is contained in:
parent
32d5e24922
commit
8b522f2e7d
23 changed files with 99 additions and 99 deletions
|
@ -257,7 +257,7 @@ impl FontHandleMethods for FontHandle {
|
|||
line_gap: height,
|
||||
};
|
||||
|
||||
debug!("Font metrics (@{}px): {:?}", em_size.to_frac32_px(), metrics);
|
||||
debug!("Font metrics (@{}px): {:?}", em_size.to_f32_px(), metrics);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ impl FontHandleMethods for FontHandle {
|
|||
|
||||
impl<'a> FontHandle {
|
||||
fn set_char_size(face: FT_Face, pt_size: Au) -> Result<(), ()>{
|
||||
let char_width = float_to_fixed_ft((0.5f64 + pt_size.to_subpx()).floor()) as FT_F26Dot6;
|
||||
let char_width = float_to_fixed_ft((0.5f64 + pt_size.to_f64_px()).floor()) as FT_F26Dot6;
|
||||
|
||||
unsafe {
|
||||
let result = FT_Set_Char_Size(face, char_width, 0, 0, 0);
|
||||
|
@ -296,6 +296,6 @@ impl<'a> FontHandle {
|
|||
// If this isn't true then we're scaling one of the axes wrong
|
||||
assert!(metrics.x_ppem == metrics.y_ppem);
|
||||
|
||||
return Au::from_frac_px(value * x_scale);
|
||||
return Au::from_f64_px(value * x_scale);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ impl FontHandleMethods for FontHandle {
|
|||
pt_size: Option<Au>)
|
||||
-> Result<FontHandle, ()> {
|
||||
let size = match pt_size {
|
||||
Some(s) => s.to_subpx(),
|
||||
Some(s) => s.to_f64_px(),
|
||||
None => 0.0
|
||||
};
|
||||
match template.ctfont {
|
||||
|
@ -162,7 +162,7 @@ impl FontHandleMethods for FontHandle {
|
|||
let bounding_rect: CGRect = self.ctfont.bounding_box();
|
||||
let ascent = self.ctfont.ascent() as f64;
|
||||
let descent = self.ctfont.descent() as f64;
|
||||
let em_size = Au::from_frac_px(self.ctfont.pt_size() as f64);
|
||||
let em_size = Au::from_f64_px(self.ctfont.pt_size() as f64);
|
||||
let leading = self.ctfont.leading() as f64;
|
||||
|
||||
let scale = px_to_pt(self.ctfont.pt_size() as f64) / (ascent + descent);
|
||||
|
@ -171,7 +171,7 @@ impl FontHandleMethods for FontHandle {
|
|||
let max_advance_width = Au::from_pt(bounding_rect.size.width as f64);
|
||||
let average_advance = self.glyph_index('0')
|
||||
.and_then(|idx| self.glyph_h_advance(idx))
|
||||
.map(|advance| Au::from_frac_px(advance))
|
||||
.map(|advance| Au::from_f64_px(advance))
|
||||
.unwrap_or(max_advance_width);
|
||||
|
||||
let metrics = FontMetrics {
|
||||
|
@ -191,7 +191,7 @@ impl FontHandleMethods for FontHandle {
|
|||
descent: Au::from_pt(descent * scale),
|
||||
max_advance: max_advance_width,
|
||||
average_advance: average_advance,
|
||||
line_gap: Au::from_frac_px(line_gap),
|
||||
line_gap: Au::from_f64_px(line_gap),
|
||||
};
|
||||
debug!("Font metrics (@{} pt): {:?}", self.ctfont.pt_size() as f64, metrics);
|
||||
return metrics;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue