text, ui: the CJK fallback fonts follow the interface language

- `effectcraft_text::fonts::set_cjk_locale` lets the host say whose face should draw Han
  ideographs instead of leaving it to the locale environment, and drops the fallback cache when
  it changes. `han_order` reads that request first; the tag → order rule moves into the pure
  `han_order_for`, so it can be tested without touching process state.
- `theme::install` now takes the stored `general.language` value and registers one CJK system
  fallback per script in every font family, the interface's own script first: kana for Japanese,
  a Han character for `zh-hans` / `zh-hant`, then the other script so names in it still render.
  A face is registered at most once, and a machine with no CJK font installs nothing (the web
  build installs nothing, as before).
- Before this the probe was always `あ`, so Han text was drawn by the Japanese face whenever the
  operating system's locale was not Chinese: a Chinese interface, and Chinese file, layer or
  template names on any locale, both got Japanese glyph forms.
- Tests: the tag → order rule (`zh`, `zh_Hans`, `zh-Hant-TW`, `ko`, `ja`, `en`, empty), and the
  registration order plus once-only registration for a Chinese, a Japanese and an English
  interface.
This commit is contained in:
FeiLiuEM
2026-10-09 19:27:47 +08:00
parent 4aaadd0ed3
commit a4d1e8d0b3
9 changed files with 194 additions and 32 deletions
+1 -1
View File
@@ -1569,7 +1569,7 @@ impl eframe::App for EffectcraftApp {
fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
self.apply_gpu_failure(ctx);
if !self.styled {
theme::install(ctx, &self.tokens);
theme::install(ctx, &self.tokens, &self.session.prefs.general.language);
fit_window(ctx);
self.styled = true;
ctx.request_repaint();