summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/cast.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/model/cast.rs b/src/model/cast.rs
index df3c8c81..6a78eebd 100644
--- a/src/model/cast.rs
+++ b/src/model/cast.rs
@@ -280,10 +280,7 @@ castable! {
castable! {
FontWeight,
Expected: "integer or string",
- Value::Int(v) => Value::Int(v)
- .cast::<usize>()?
- .try_into()
- .map_or(Self::BLACK, Self::from_number),
+ Value::Int(v) => Self::from_number(v.clamp(0, u16::MAX as i64) as u16),
Value::Str(string) => match string.as_str() {
"thin" => Self::THIN,
"extralight" => Self::EXTRALIGHT,