From 1277e07671a15b87832af90c7244a0cac480b829 Mon Sep 17 00:00:00 2001 From: Aaron Williamson Date: Sat, 22 Apr 2017 14:01:25 -0600 Subject: [PATCH] Remove unnecessary size argument to metrics function The changes to metric consumption rendered the size argument unnecessary, remove it. --- font/src/darwin/mod.rs | 4 +--- font/src/ft/mod.rs | 2 +- font/src/lib.rs | 4 ++-- src/renderer/mod.rs | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/font/src/darwin/mod.rs b/font/src/darwin/mod.rs index 757dd5f8..9e92923e 100644 --- a/font/src/darwin/mod.rs +++ b/font/src/darwin/mod.rs @@ -135,9 +135,7 @@ impl ::Rasterize for Rasterizer { } /// Get metrics for font specified by FontKey - fn metrics(&self, key: FontKey, _size: Size) -> Result { - // NOTE size is not needed here since the font loaded already contains - // it. It's part of the API due to platform differences. + fn metrics(&self, key: FontKey) -> Result { let font = self.fonts .get(&key) .ok_or(Error::FontNotLoaded)?; diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index 24ef5c77..c04057cd 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -54,7 +54,7 @@ impl ::Rasterize for FreeTypeRasterizer { }) } - fn metrics(&self, key: FontKey, size: Size) -> Result { + fn metrics(&self, key: FontKey) -> Result { let face = self.faces .get(&key) .ok_or(Error::FontNotLoaded)?; diff --git a/font/src/lib.rs b/font/src/lib.rs index 7b8d92e7..292e2244 100644 --- a/font/src/lib.rs +++ b/font/src/lib.rs @@ -229,8 +229,8 @@ pub trait Rasterize { fn new(dpi_x: f32, dpi_y: f32, device_pixel_ratio: f32, use_thin_strokes: bool) -> Result where Self: Sized; - /// Get `Metrics` for the given `FontKey` and `Size` - fn metrics(&self, FontKey, Size) -> Result; + /// Get `Metrics` for the given `FontKey` + fn metrics(&self, FontKey) -> Result; /// Load the font described by `FontDesc` and `Size` fn load_font(&mut self, &FontDesc, Size) -> Result; diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 585bea10..13e84807 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -246,7 +246,7 @@ impl GlyphCache { pub fn font_metrics(&self) -> font::Metrics { self.rasterizer - .metrics(self.font_key, self.font_size) + .metrics(self.font_key) .expect("metrics load since font is loaded at glyph cache creation") }