Fonts compute their own metrics using NativeFont.

This commit is contained in:
Brian J. Burg 2012-10-15 13:48:14 -07:00
parent e28827d1c0
commit 54f1e83844
2 changed files with 5 additions and 3 deletions

View file

@ -75,6 +75,7 @@ pub impl Font : FontMethods {
ascent: em_size.scale_by(em_ascent),
descent: em_size.scale_by(em_descent),
};
return metrics;
}
@ -96,7 +97,9 @@ pub impl Font : FontMethods {
// TODO: font should compute its own metrics using native_font.
// TODO: who should own fontbuf?
fn Font(lib: @FontCache, fontbuf: @~[u8], native_font: NativeFont, metrics: FontMetrics) -> Font {
fn Font(lib: @FontCache, fontbuf: @~[u8], native_font: NativeFont) -> Font {
let metrics = native_font.get_metrics();
Font {
lib: lib,
fontbuf : fontbuf,

View file

@ -44,8 +44,7 @@ fn create_font(lib: @FontCache, native_lib: &native::NativeFontCache) -> Result<
} else {
return Err(native_font.get_err());
};
let metrics = native_font.get_metrics();
return Ok(@Font(lib, font_bin, native_font, metrics));
return Ok(@Font(lib, font_bin, native_font));
}
#[cfg(target_os = "linux")]