aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/platform/macos
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2018-02-04 21:03:55 +0100
committerJon Leighton <j@jonathanleighton.com>2018-02-22 11:45:42 +0100
commit799bf87f6d5dc1aeae8370c22229a88b7e12a412 (patch)
tree4206e988f32f8a3b49577721f54e5b55cf7d8aaa /components/gfx/platform/macos
parent691f3be24a6fcc90ae7d0b9b0783abf8674e1b0f (diff)
downloadservo-799bf87f6d5dc1aeae8370c22229a88b7e12a412.tar.gz
servo-799bf87f6d5dc1aeae8370c22229a88b7e12a412.zip
Make FontTemplateData's Debug formatter more concise
Otherwise the log gets spammed with all the individual bytes of the underlying font file.
Diffstat (limited to 'components/gfx/platform/macos')
-rw-r--r--components/gfx/platform/macos/font_template.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/components/gfx/platform/macos/font_template.rs b/components/gfx/platform/macos/font_template.rs
index c4c14cfd420..15cc2a8689c 100644
--- a/components/gfx/platform/macos/font_template.rs
+++ b/components/gfx/platform/macos/font_template.rs
@@ -24,8 +24,10 @@ use webrender_api::NativeFontHandle;
/// The identifier is a PostScript font name. The
/// CTFont object is cached here for use by the
/// paint functions that create CGFont references.
-#[derive(Debug, Deserialize, Serialize)]
+#[derive(Deserialize, Serialize)]
pub struct FontTemplateData {
+ // If you add members here, review the Debug impl below
+
/// The `CTFont` object, if present. This is cached here so that we don't have to keep creating
/// `CTFont` instances over and over. It can always be recreated from the `identifier` and/or
/// `font_data` fields.
@@ -39,6 +41,21 @@ pub struct FontTemplateData {
pub font_data: Option<Arc<Vec<u8>>>
}
+impl fmt::Debug for FontTemplateData {
+ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fmt.debug_struct("FontTemplateData")
+ .field("ctfont", &self.ctfont)
+ .field("identifier", &self.identifier)
+ .field(
+ "font_data",
+ &self.font_data
+ .as_ref()
+ .map(|bytes| format!("[{} bytes]", bytes.len()))
+ )
+ .finish()
+ }
+}
+
unsafe impl Send for FontTemplateData {}
unsafe impl Sync for FontTemplateData {}