Skip to content

Commit

Permalink
Fix android/font.rs. Add an issue in macos/font.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
june0cho committed Sep 16, 2013
1 parent 4d719df commit 7436c10
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion src/components/gfx/platform/android/font.rs
Expand Up @@ -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();
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/components/gfx/platform/macos/font.rs
Expand Up @@ -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,
Expand Down

4 comments on commit 7436c10

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from metajack
at june0cho@7436c10

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging june0cho/servo/text_deco = 7436c107 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

june0cho/servo/text_deco = 7436c107 merged ok, testing candidate = 2223eac

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.