mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-14 19:27:05 -04:00
A Windows user reported that the Properties panel's font menu offered only the bundled Inter,
JetBrains Mono and Noto Serif. The system font folders were scanned only when a project asked for
a family the bundled fonts lack, so until then every font menu (Properties, Character, Essential
Graphics) and `file.findMissing {what: fonts}` saw the bundled families alone, on every
platform. Listing the families now scans the system fonts first, and the desktop app starts that
scan on a background thread at launch so the menus are complete when first opened.
The style menus in the Properties and Character panels list the chosen family's own styles
instead of a fixed Regular / Medium / SemiBold / Bold / Italic. Both menus build their lists only
while open.
New query for agents: `text.fonts {query?, rescan?}` (MCP tool `list_fonts`) lists every family
with its styles, origin (bundled / system / user) and own-language name; `rescan` picks up fonts
installed since launch.
Tests: a fresh-process test that the family list includes every family in the platform's font
folders without a prior scan (failed before), and `text.fonts` filtering, rescan and per-family
styles, and the `list_fonts` MCP tool.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019EjTYdt76hTG4Kh2CJFnCr
20 lines
1.0 KiB
Rust
20 lines
1.0 KiB
Rust
//! The font menus list the installed fonts (issue: on Windows the Properties panel's font menu
|
|
//! offered only Inter, JetBrains Mono and Noto Serif). Its own test binary, so the system font
|
|
//! scan has not run yet when it starts.
|
|
|
|
use effectcraft_text::fonts::{DirectorySource, FontSource, families, system_scanned};
|
|
|
|
#[test]
|
|
fn families_include_installed_fonts_without_a_prior_scan() {
|
|
assert!(!system_scanned(), "nothing has scanned yet in this process");
|
|
let listed: Vec<String> = families().into_iter().map(|(f, _)| f).collect();
|
|
assert!(system_scanned() || cfg!(target_arch = "wasm32"), "listing the families scans the system fonts");
|
|
for b in ["Inter", "JetBrains Mono", "Noto Serif"] {
|
|
assert!(listed.iter().any(|f| f == b), "bundled {b} listed");
|
|
}
|
|
// Every family found in the platform's font folders is in the menu.
|
|
for face in DirectorySource::system().faces() {
|
|
assert!(listed.iter().any(|f| f.eq_ignore_ascii_case(&face.family)), "installed family {} missing from {listed:?}", face.family);
|
|
}
|
|
}
|