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:
NimBold
2026-07-23 17:29:29 +03:30
parent 1f1ec828f9
commit b579c35e42
17 changed files with 157 additions and 7 deletions
+5 -1
View File
@@ -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,
}
+25 -1
View File
@@ -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!({