Merge pull request #312 from FeiLiuEM/font/cjk-locale

text, ui: the CJK fallback fonts follow the interface language
This commit is contained in:
Brandon Thomas
2026-10-09 09:28:38 -04:00
11 changed files with 213 additions and 38 deletions
+13 -4
View File
@@ -213,6 +213,8 @@ pub struct EffectcraftApp {
last_time: f64,
styled: bool,
fonts_ready: bool,
/// The interface language the fonts were installed for; `""` until the first frame.
styled_language: &'static str,
pub(crate) control_rx: Option<Receiver<ControlRequest>>,
pub(crate) deferred: Vec<(ControlRequest, f64)>,
pub(crate) synthetic: Vec<egui::Event>,
@@ -299,6 +301,7 @@ impl EffectcraftApp {
last_time: 0.0,
styled: false,
fonts_ready: false,
styled_language: "",
control_rx: None,
deferred: vec![],
synthetic: vec![],
@@ -1573,10 +1576,16 @@ 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);
fit_window(ctx);
self.styled = true;
// The CJK fallback fonts depend on the interface language, so they follow a change of
// Settings ▸ General ▸ Language instead of only the first frame.
let language = crate::i18n::language(self);
if !self.styled || self.styled_language != language {
theme::install(ctx, &self.tokens, language);
self.styled_language = language;
if !self.styled {
fit_window(ctx);
self.styled = true;
}
ctx.request_repaint();
} else {
self.fonts_ready = true;