mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix android/font.rs. Add an issue in macos/font.rs
This commit is contained in:
parent
4d719df5e9
commit
7436c107c1
2 changed files with 19 additions and 3 deletions
|
@ -219,6 +219,7 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn get_metrics(&self) -> FontMetrics {
|
||||
/* TODO(Issue #76): complete me */
|
||||
let face = self.get_face_rec();
|
||||
|
@ -230,11 +231,26 @@ impl FontHandleMethods for FontHandle {
|
|||
let descent = self.font_units_to_au(face.descender as float);
|
||||
let max_advance = self.font_units_to_au(face.max_advance_width as float);
|
||||
|
||||
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);
|
||||
unsafe {
|
||||
let os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2) as *TT_OS2;
|
||||
let valid = os2.is_not_null() && (*os2).version != 0xffff;
|
||||
if valid {
|
||||
strikeout_size = self.font_units_to_au((*os2).yStrikeoutSize as float);
|
||||
strikeout_offset = self.font_units_to_au((*os2).yStrikeoutPosition as float);
|
||||
x_height = self.font_units_to_au((*os2).sxHeight as float);
|
||||
}
|
||||
}
|
||||
|
||||
return FontMetrics {
|
||||
underline_size: underline_size,
|
||||
underline_offset: underline_offset,
|
||||
strikeout_size: strikeout_size,
|
||||
strikeout_offset: strikeout_offset,
|
||||
leading: geometry::from_pt(0.0), //FIXME
|
||||
x_height: geometry::from_pt(0.0), //FIXME
|
||||
x_height: x_height,
|
||||
em_size: em_size,
|
||||
ascent: ascent,
|
||||
descent: -descent, // linux font's seem to use the opposite sign from mac
|
||||
|
|
|
@ -171,8 +171,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 float),
|
||||
strikeout_size: geometry::from_pt(0.0), //FIXME
|
||||
strikeout_offset: geometry::from_pt(0.0), //FIXME
|
||||
strikeout_size: geometry::from_pt(0.0), // FIXME(Issue #942)
|
||||
strikeout_offset: geometry::from_pt(0.0), // FIXME(Issue #942)
|
||||
leading: Au::from_pt(self.ctfont.leading() as float),
|
||||
x_height: Au::from_pt(self.ctfont.x_height() as float),
|
||||
em_size: em_size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue