feat: allow users to specify a custom font (closes #176)
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m57s
CI / Lint & Test (pull_request) Successful in 24m12s
CI / Build Linux (pull_request) Successful in 23m48s
CI / Build Windows (cross-compile) (pull_request) Successful in 37m48s

Adds support for loading a custom font from either a remote URL or a
local file path, and applying it to the terminal and input bar.

- Rust: adds `custom_font_path` and `custom_font_family` fields to
  `HikariConfig` with `#[serde(default)]` for backwards compatibility
- TypeScript: extends `HikariConfig` interface and `defaultConfig`;
  exports `applyCustomFont()` which injects an `@import` for CSS
  stylesheet URLs, a `@font-face` rule for direct font file URLs, or a
  base64 data URL `@font-face` for local files via Tauri `readFile`;
  adds `setCustomFont()` to the config store
- Terminal.svelte and InputBar.svelte now use
  `--terminal-font-family` CSS variable (falls back to `monospace`)
- ConfigSidebar.svelte: new "Custom Font" section with URL/path input,
  family name input, Apply + Reset buttons, and inline status feedback
- `+page.svelte`: applies saved font on startup alongside theme/size
- 14 new tests for `applyCustomFont` (all code paths) + 2 for
  `setCustomFont`
This commit is contained in:
2026-03-03 18:07:14 -08:00
committed by Naomi Carrigan
parent 9061098b0f
commit 5bfff9d5e0
8 changed files with 353 additions and 3 deletions
+13
View File
@@ -144,6 +144,13 @@ pub struct HikariConfig {
#[serde(default)]
pub show_thinking_blocks: bool,
// Custom font settings
#[serde(default)]
pub custom_font_path: Option<String>,
#[serde(default)]
pub custom_font_family: Option<String>,
}
impl Default for HikariConfig {
@@ -183,6 +190,8 @@ impl Default for HikariConfig {
background_image_path: None,
background_image_opacity: 0.3,
show_thinking_blocks: false,
custom_font_path: None,
custom_font_family: None,
}
}
}
@@ -298,6 +307,8 @@ mod tests {
assert!(!config.disable_1m_context);
assert!(config.trusted_workspaces.is_empty());
assert!(!config.show_thinking_blocks);
assert!(config.custom_font_path.is_none());
assert!(config.custom_font_family.is_none());
}
#[test]
@@ -337,6 +348,8 @@ mod tests {
background_image_path: Some("/home/naomi/bg.png".to_string()),
background_image_opacity: 0.25,
show_thinking_blocks: true,
custom_font_path: Some("/home/naomi/.fonts/MyFont.ttf".to_string()),
custom_font_family: Some("MyFont".to_string()),
};
let json = serde_json::to_string(&config).unwrap();