Fix subtraction overflow when comparing weights
This commit is contained in:
parent
8457e68d98
commit
6aadfaddac
2 changed files with 5 additions and 5 deletions
|
|
@ -11,7 +11,7 @@ pub use rustybuzz;
|
|||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct FontMatchKey {
|
||||
pub(crate) weight_offset: u16,
|
||||
pub(crate) weight_offset: Option<u16>,
|
||||
pub(crate) id: fontdb::ID,
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ impl FontSystem {
|
|||
.faces()
|
||||
.filter(|face| attrs.matches(face))
|
||||
.map(|face| FontMatchKey {
|
||||
weight_offset: attrs.weight.0 - face.weight.0,
|
||||
weight_offset: attrs.weight.0.checked_sub(face.weight.0),
|
||||
id: face.id,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue