summaryrefslogtreecommitdiff
path: root/src/font
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-09-21 17:50:58 +0200
committerLaurenz <laurmaedje@gmail.com>2022-09-21 20:25:57 +0200
commitddd3b6a82b8c0353c942bfba8b89ca5476eedc58 (patch)
treea64c350f0f1f82152ff18cfb02fbfdbf39292672 /src/font
parent3760748fddd3b793c79c370398a9d4a3fc5afc04 (diff)
Tracked memoization
Diffstat (limited to 'src/font')
-rw-r--r--src/font/book.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/font/book.rs b/src/font/book.rs
index 323eb84f..29190516 100644
--- a/src/font/book.rs
+++ b/src/font/book.rs
@@ -8,7 +8,7 @@ use unicode_segmentation::UnicodeSegmentation;
use super::{Font, FontStretch, FontStyle, FontVariant, FontWeight};
/// Metadata about a collection of fonts.
-#[derive(Default)]
+#[derive(Default, Clone, Hash)]
pub struct FontBook {
/// Maps from lowercased family names to font indices.
families: BTreeMap<String, Vec<usize>>,
@@ -144,7 +144,7 @@ impl FontBook {
}
/// Properties of a single font.
-#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct FontInfo {
/// The typographic font family this font is part of.
pub family: String,
@@ -377,7 +377,7 @@ fn shared_prefix_words(left: &str, right: &str) -> usize {
/// - 2 codepoints inside (18, 19)
///
/// So the resulting encoding is `[2, 3, 4, 3, 3, 1, 2, 2]`.
-#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Coverage(Vec<u32>);