Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for line heights calculations. #502

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Scale the font size to pixels from pt. It seems like the font librari…

…es are expecting pixels, not points like the docs say. The glyph advance is also scaled slightly to match what is show in Firefox.
  • Loading branch information
jrfeenst committed Jun 7, 2013
commit 0747a0f44e78a60e02014e7321ca083b3154d08e
@@ -150,7 +150,8 @@ impl FontHandleMethods for FontHandle {
&glyphs[0],
ptr::null(),
1);
Some(advance as FractionalPixel)
// TODO; On mac the font spacing looks a little small. Need to figure out why.
Some(advance * 1.08f as FractionalPixel)
}

fn get_metrics(&self) -> FontMetrics {
@@ -169,10 +170,9 @@ impl FontHandleMethods for FontHandle {
underline_offset: Au::from_pt(self.ctfont.underline_position() as float),
leading: Au::from_pt(self.ctfont.leading() as float),
x_height: Au::from_pt(self.ctfont.x_height() as float),
// TODO: the ascent and descent need to be scaled by the pt_size, figure out why
em_size: em_size,
ascent: ascent * em_size / (ascent + descent),
descent: descent * em_size / (ascent + descent),
ascent: ascent,
descent: descent,
max_advance: Au::from_pt(bounding_rect.size.width as float)
};

@@ -763,7 +763,7 @@ pub impl RenderBox {
};

FontStyle {
pt_size: font_size,
pt_size: font_size * 96f / 72f, // TODO: scale to pt
weight: FontWeight300,
italic: italic,
oblique: oblique,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.