diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs index a50fea14986f..26490d9c52c4 100644 --- a/components/gfx/platform/windows/font.rs +++ b/components/gfx/platform/windows/font.rs @@ -9,13 +9,15 @@ use app_units::Au; use dwrote; use dwrote::{Font, FontFace, FontFile}; -use dwrote::{FontWeight, FontStretch, FontStyle}; +use dwrote::{FontStretch, FontStyle}; use font::{FontHandleMethods, FontMetrics, FontTableMethods}; use font::{FontTableTag, FractionalPixel}; use platform::font_template::FontTemplateData; use platform::windows::font_context::FontContextHandle; use platform::windows::font_list::font_from_atom; use servo_atoms::Atom; +use std::fmt; +use std::ops::Deref; use std::sync::Arc; use style::computed_values::font_stretch::T as StyleFontStretch; use style::computed_values::font_weight::T as StyleFontWeight; @@ -238,7 +240,7 @@ impl FontInfo { #[derive(Debug)] pub struct FontHandle { font_data: Arc, - face: FontFace, + face: Nondebug, info: FontInfo, em_size: f32, du_per_em: f32, @@ -246,6 +248,21 @@ pub struct FontHandle { scaled_du_to_px: f32, } +struct Nondebug(T); + +impl fmt::Debug for Nondebug { + fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result { + Ok(()) + } +} + +impl Deref for Nondebug { + type Target = T; + fn deref(&self) -> &T { + &self.0 + } +} + impl FontHandle {} impl FontHandleMethods for FontHandle { @@ -284,7 +301,7 @@ impl FontHandleMethods for FontHandle { Ok(FontHandle { font_data: template.clone(), - face: face, + face: Nondebug(face), info: info, em_size: em_size, du_per_em: du_per_em,