diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2020-01-31 17:54:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 14:54:02 +0000 |
commit | 15cc07c069b09f109ed18fb94e02e9650be7fa33 (patch) | |
tree | 5d14ad312ab64c4b7bd55fc50d8308bd6c3b1611 /font/src/ft/fc/pattern.rs | |
parent | 2ef5e47b8e8591d9df5e3198daad9308b7851343 (diff) | |
download | alacritty-15cc07c069b09f109ed18fb94e02e9650be7fa33.tar.gz alacritty-15cc07c069b09f109ed18fb94e02e9650be7fa33.zip |
Fix handling of OpenType variable fonts
Fixes #3257.
Diffstat (limited to 'font/src/ft/fc/pattern.rs')
-rw-r--r-- | font/src/ft/fc/pattern.rs | 9 |
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 |