Move font matching to Attrs

This commit is contained in:
Jeremy Soller 2022-10-25 15:51:28 -06:00
parent 324c8837fd
commit 085231c153
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE
2 changed files with 17 additions and 15 deletions

View file

@ -45,4 +45,12 @@ impl<'a> Attrs<'a> {
self.weight = weight;
self
}
pub fn matches(&self, face: &fontdb::FaceInfo) -> bool {
face.style == self.style &&
face.weight == self.weight &&
face.stretch == self.stretch &&
//TODO: smarter way of including emoji
(face.monospaced == self.monospaced || face.post_script_name.contains("Emoji"))
}
}