1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-28 01:06:37 +03:00

font: add Debug implementation for Pattern and FontSet

This commit is contained in:
Jeremy Fitzhardinge 2019-12-05 00:24:06 -08:00 committed by Wez Furlong
parent 5b6bad2c51
commit 6420a47ad2

View File

@ -3,6 +3,7 @@
use failure::{ensure, err_msg, format_err, Error};
pub use fontconfig::*;
use std::ffi::{CStr, CString};
use std::fmt;
use std::mem;
use std::ptr;
@ -20,6 +21,12 @@ impl Drop for FontSet {
}
}
impl fmt::Debug for FontSet {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_list().entries(self.iter()).finish()
}
}
pub struct FontSetIter<'a> {
set: &'a FontSet,
position: isize,
@ -254,3 +261,13 @@ impl Drop for Pattern {
}
}
}
impl fmt::Debug for Pattern {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.write_str(
&self
.format("Pattern(%{+family,style,weight,slant,spacing{%{=unparse}}})")
.unwrap(),
)
}
}