mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-11 03:59:09 +00:00
feat(settings): add curated multilingual fonts
Bundle Vazirmatn, Noto Sans Hebrew, Noto Sans SC, and Roboto with locale-aware fallbacks while keeping custom font import out of scope. Refs #31
This commit is contained in:
@@ -215,12 +215,16 @@ pub enum Theme {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, TS)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
#[ts(export, export_to = "../../src/bindings/")]
|
||||
pub enum FontFamily {
|
||||
System,
|
||||
Inter,
|
||||
Outfit,
|
||||
Vazirmatn,
|
||||
NotoSansHebrew,
|
||||
NotoSansSc,
|
||||
Roboto,
|
||||
Serif,
|
||||
Monospace,
|
||||
}
|
||||
|
||||
@@ -196,7 +196,17 @@ fn sanitize_persisted_setting_values(state: &mut Value) {
|
||||
sanitize_allowed_string(
|
||||
state,
|
||||
"fontFamily",
|
||||
&["system", "inter", "outfit", "serif", "monospace"],
|
||||
&[
|
||||
"system",
|
||||
"inter",
|
||||
"outfit",
|
||||
"vazirmatn",
|
||||
"noto-sans-hebrew",
|
||||
"noto-sans-sc",
|
||||
"roboto",
|
||||
"serif",
|
||||
"monospace",
|
||||
],
|
||||
);
|
||||
sanitize_allowed_string(
|
||||
state,
|
||||
@@ -704,6 +714,20 @@ mod tests {
|
||||
assert!(matches!(settings.font_family, FontFamily::System));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn curated_font_families_are_preserved() {
|
||||
for value in ["vazirmatn", "noto-sans-hebrew", "noto-sans-sc", "roboto"] {
|
||||
let stored = json!({
|
||||
"state": {"fontFamily": value},
|
||||
"version": 5
|
||||
});
|
||||
|
||||
let settings = decode_stored_settings(&Value::String(stored.to_string())).unwrap();
|
||||
|
||||
assert_eq!(serde_json::to_value(settings.font_family).unwrap(), json!(value));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_window_control_style_uses_automatic_layout() {
|
||||
let stored = json!({
|
||||
|
||||
Reference in New Issue
Block a user