summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Williamson <guitarfanman@gmail.com>2017-01-28 19:30:47 -0700
committerJoe Wilm <jwilm@users.noreply.github.com>2017-05-01 08:52:22 -0700
commit7fc50f669056dc9a3a601b3f0248926384abb570 (patch)
tree8e00bef97c77714e55f4f25036f6760d2b1d1c8a /src
parentac2a1ece9e30d8253c40bf2f1b44626292ea4f4d (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/config.rs18
1 files changed, 8 insertions, 10 deletions
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>(D) -> ::std::result::Result<Self, D::Error>
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()
}
}
}