summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/font.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/src/font.rs b/core/src/font.rs
index 3f9ad2b5..130e378e 100644
--- a/core/src/font.rs
+++ b/core/src/font.rs
@@ -1,3 +1,5 @@
+use std::hash::{Hash, Hasher};
+
/// A font.
#[derive(Debug, Clone, Copy)]
pub enum Font {
@@ -22,3 +24,17 @@ impl Default for Font {
Font::Default
}
}
+
+impl Hash for Font {
+ fn hash<H: Hasher>(&self, hasher: &mut H) {
+ match self {
+ Self::Default => {
+ 0.hash(hasher);
+ }
+ Self::External { name, .. } => {
+ 1.hash(hasher);
+ name.hash(hasher);
+ }
+ }
+ }
+}