summaryrefslogtreecommitdiff
path: root/font/src/ft/fc/pattern.rs
diff options
context:
space:
mode:
Diffstat (limited to 'font/src/ft/fc/pattern.rs')
-rw-r--r--font/src/ft/fc/pattern.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/font/src/ft/fc/pattern.rs b/font/src/ft/fc/pattern.rs
index f69f0926..af7640a9 100644
--- a/font/src/ft/fc/pattern.rs
+++ b/font/src/ft/fc/pattern.rs
@@ -23,7 +23,7 @@ use libc::{c_char, c_double, c_int};
use super::ffi::FcResultMatch;
use super::ffi::{FcBool, FcFontRenderPrepare, FcPatternGetBool, FcPatternGetDouble};
-use super::ffi::{FcChar8, FcConfigSubstitute, FcDefaultSubstitute, FcPattern};
+use super::ffi::{FcChar8, FcConfigSubstitute, FcDefaultSubstitute, FcPattern, FcPatternHash};
use super::ffi::{FcPatternAddCharSet, FcPatternDestroy, FcPatternDuplicate, FcPatternGetCharSet};
use super::ffi::{FcPatternAddDouble, FcPatternAddString, FcPatternCreate, FcPatternGetString};
use super::ffi::{FcPatternAddInteger, FcPatternGetInteger, FcPatternPrint};
@@ -353,6 +353,9 @@ macro_rules! string_accessor {
}
}
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
+pub struct PatternHash(u32);
+
impl Pattern {
pub fn new() -> Self {
Self::default()
@@ -537,6 +540,10 @@ impl PatternRef {
}
}
+ pub fn hash(&self) -> PatternHash {
+ unsafe { PatternHash(FcPatternHash(self.as_ptr())) }
+ }
+
/// Add charset to the pattern
///
/// The referenced charset is copied by fontconfig internally using