From 7fc50f669056dc9a3a601b3f0248926384abb570 Mon Sep 17 00:00:00 2001 From: Aaron Williamson Date: Sat, 28 Jan 2017 19:30:47 -0700 Subject: Improve freetype metric usage The font metrics function was using freetype metrics in an ineffective way, improve the use of those metrics and remove the now unnecessary separate default values for font offset in linux. --- src/config.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/config.rs b/src/config.rs index ba1ae5f8..61bdb256 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1189,6 +1189,12 @@ impl FontOffset { } } +impl Default for FontOffset { + fn default() -> FontOffset { + FontOffset { x: 0.0, y: 0.0 } + } +} + trait DeserializeFromF32 : Sized { fn deserialize_from_f32(D) -> ::std::result::Result where D: serde::de::Deserializer; @@ -1301,10 +1307,7 @@ impl Default for Font { italic: FontDescription::new_with_family("Menlo"), size: Size::new(11.0), use_thin_strokes: true, - offset: FontOffset { - x: 0.0, - y: 0.0 - } + offset: Default::default() } } } @@ -1318,12 +1321,7 @@ impl Default for Font { italic: FontDescription::new_with_family("monospace"), size: Size::new(11.0), use_thin_strokes: false, - offset: FontOffset { - // TODO should improve freetype metrics... shouldn't need such - // drastic offsets for the default! - x: 2.0, - y: -7.0 - } + offset: Default::default() } } } -- cgit