Font related improvements
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
//! Shared, validated typography settings for all built-in OBS components.
|
||||
//!
|
||||
//! Font IDs map to fixed frontend font stacks rather than accepting arbitrary
|
||||
//! CSS. This keeps settings portable between OBS hosts and prevents untrusted
|
||||
//! component settings from becoming a CSS injection boundary.
|
||||
//! Font IDs map to fixed, same-origin WOFF2 assets in the frontend rather than
|
||||
//! accepting arbitrary CSS. This keeps settings portable between OBS hosts and
|
||||
//! prevents untrusted component settings from becoming a CSS injection boundary.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -13,6 +13,7 @@ pub enum FontFamilyId {
|
||||
#[default]
|
||||
FangSong,
|
||||
Kai,
|
||||
LiyuShoushu,
|
||||
}
|
||||
|
||||
pub const fn default_font_brightness() -> u16 {
|
||||
@@ -35,5 +36,9 @@ mod tests {
|
||||
);
|
||||
assert_eq!(sanitize_font_brightness(1), 70);
|
||||
assert_eq!(sanitize_font_brightness(u16::MAX), 180);
|
||||
assert_eq!(
|
||||
serde_json::to_string(&FontFamilyId::LiyuShoushu).unwrap(),
|
||||
"\"liyu-shoushu\""
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user