mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Replace Au-related free functions in util::geometry with Au methods.
This commit is contained in:
parent
49aed6555d
commit
32d5e24922
12 changed files with 50 additions and 92 deletions
|
@ -7,7 +7,6 @@ extern crate freetype;
|
|||
use font::{FontHandleMethods, FontMetrics, FontTableMethods};
|
||||
use font::{FontTableTag, FractionalPixel};
|
||||
use util::geometry::Au;
|
||||
use util::geometry;
|
||||
use util::str::c_str_to_string;
|
||||
use platform::font_context::FontContextHandle;
|
||||
use text::glyph::GlyphId;
|
||||
|
@ -225,9 +224,9 @@ impl FontHandleMethods for FontHandle {
|
|||
let height = self.font_units_to_au(face.height as f64);
|
||||
let leading = height - (ascent + descent);
|
||||
|
||||
let mut strikeout_size = geometry::from_pt(0.0);
|
||||
let mut strikeout_offset = geometry::from_pt(0.0);
|
||||
let mut x_height = geometry::from_pt(0.0);
|
||||
let mut strikeout_size = Au(0);
|
||||
let mut strikeout_offset = Au(0);
|
||||
let mut x_height = Au(0);
|
||||
unsafe {
|
||||
let os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2) as *mut TT_OS2;
|
||||
let valid = !os2.is_null() && (*os2).version != 0xffff;
|
||||
|
@ -258,7 +257,7 @@ impl FontHandleMethods for FontHandle {
|
|||
line_gap: height,
|
||||
};
|
||||
|
||||
debug!("Font metrics (@{} pt): {:?}", geometry::to_pt(em_size), metrics);
|
||||
debug!("Font metrics (@{}px): {:?}", em_size.to_frac32_px(), metrics);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
|
@ -297,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 geometry::from_frac_px(value * x_scale);
|
||||
return Au::from_frac_px(value * x_scale);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,8 +182,8 @@ impl FontHandleMethods for FontHandle {
|
|||
// see also: https://bugs.webkit.org/show_bug.cgi?id=16768
|
||||
// see also: https://bugreports.qt-project.org/browse/QTBUG-13364
|
||||
underline_offset: Au::from_pt(self.ctfont.underline_position() as f64),
|
||||
strikeout_size: geometry::from_pt(0.0), // FIXME(Issue #942)
|
||||
strikeout_offset: geometry::from_pt(0.0), // FIXME(Issue #942)
|
||||
strikeout_size: Au(0), // FIXME(Issue #942)
|
||||
strikeout_offset: Au(0), // FIXME(Issue #942)
|
||||
leading: Au::from_pt(leading),
|
||||
x_height: Au::from_pt(self.ctfont.x_height() as f64),
|
||||
em_size: em_size,
|
||||
|
|
|
@ -8,7 +8,7 @@ use platform::font_template::FontTemplateData;
|
|||
use util::geometry::Au;
|
||||
use util::range::Range;
|
||||
use util::vec::{Comparator, FullBinarySearchMethods};
|
||||
use std::cmp::Ordering;
|
||||
use std::cmp::{Ordering, max};
|
||||
use std::slice::Iter;
|
||||
use std::sync::Arc;
|
||||
use text::glyph::{CharIndex, GlyphStore};
|
||||
|
@ -322,7 +322,7 @@ impl<'a> TextRun {
|
|||
debug!("iterating outer range {:?}", range);
|
||||
self.natural_word_slices_in_range(range).fold(Au(0), |max_piece_width, slice| {
|
||||
debug!("iterated on {:?}[{:?}]", slice.offset, slice.range);
|
||||
Au::max(max_piece_width, self.advance_for_range(&slice.range))
|
||||
max(max_piece_width, self.advance_for_range(&slice.range))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue