From 54f1e8384479a8ad2a8d62a7a06f3fb00b83ba96 Mon Sep 17 00:00:00 2001 From: "Brian J. Burg" Date: Mon, 15 Oct 2012 13:48:14 -0700 Subject: [PATCH] Fonts compute their own metrics using NativeFont. --- src/servo/text/font.rs | 5 ++++- src/servo/text/font_cache.rs | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/servo/text/font.rs b/src/servo/text/font.rs index c381322b934..2073161ec85 100644 --- a/src/servo/text/font.rs +++ b/src/servo/text/font.rs @@ -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, diff --git a/src/servo/text/font_cache.rs b/src/servo/text/font_cache.rs index 075a5cc66cf..a1d877bb8b0 100644 --- a/src/servo/text/font_cache.rs +++ b/src/servo/text/font_cache.rs @@ -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")]