mirror of
https://github.com/servo/servo.git
synced 2025-08-16 02:45:36 +01:00
Make FontTemplateData's Debug formatter more concise
Otherwise the log gets spammed with all the individual bytes of the underlying font file.
This commit is contained in:
parent
691f3be24a
commit
799bf87f6d
3 changed files with 49 additions and 3 deletions
|
@ -4,15 +4,32 @@
|
|||
|
||||
use platform::windows::font_list::{descriptor_from_atom, font_from_atom};
|
||||
use servo_atoms::Atom;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use webrender_api::NativeFontHandle;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct FontTemplateData {
|
||||
// If you add members here, review the Debug impl below
|
||||
|
||||
pub bytes: Option<Vec<u8>>,
|
||||
pub identifier: Atom,
|
||||
}
|
||||
|
||||
impl fmt::Debug for FontTemplateData {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("FontTemplateData")
|
||||
.field(
|
||||
"bytes",
|
||||
&self.bytes
|
||||
.as_ref()
|
||||
.map(|bytes| format!("[{} bytes]", bytes.len()))
|
||||
)
|
||||
.field("identifier", &self.identifier)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl FontTemplateData {
|
||||
pub fn new(identifier: Atom,
|
||||
font_data: Option<Vec<u8>>) -> Result<FontTemplateData, io::Error> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue