From 8b10942d11a09f0c485ecaaa2ea925dae84a776f Mon Sep 17 00:00:00 2001 From: Davit Matchakhelidze Date: Fri, 23 Oct 2026 02:16:03 +0400 Subject: [PATCH] Keep Georgian lower case in upper-case labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mono labels and buttons are drawn with `to_uppercase()`, which maps Georgian Mkhedruli to Mtavruli (U+1C90–U+1CBF). Georgian has no letter case, and most system Georgian fonts (DejaVu Sans, Sylfaen) have no Mtavruli glyphs, so every Georgian label turned into boxes. `upper` keeps Georgian letters as written and upper-cases everything else. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YMTAbGNRxnMEzRvYnQGphF --- crates/ui-egui/src/widgets.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 81448dda..be077cac 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -20,10 +20,23 @@ pub fn tone_color(t: &Tokens, tone: Tone) -> Color32 { } } +/// `text` in upper case, except Georgian: Georgian has no letter case, and the capitals Unicode maps +/// its letters to (Mtavruli, U+1C90–U+1CBF) are a display style most system fonts don't draw. +fn upper(text: &str) -> String { + text.chars().fold(String::with_capacity(text.len()), |mut out, c| { + if ('\u{10d0}'..='\u{10ff}').contains(&c) { + out.push(c); + } else { + out.extend(c.to_uppercase()); + } + out + }) +} + /// `text` laid out upper case in `family`, `spacing` points between letters. pub fn caps(ui: &Ui, text: &str, size: f32, family: egui::FontFamily, spacing: f32, color: Color32) -> Arc { let format = egui::TextFormat { font_id: egui::FontId::new(size, family), color, extra_letter_spacing: spacing, ..Default::default() }; - ui.painter().layout_job(egui::text::LayoutJob::single_section(text.to_uppercase(), format)) + ui.painter().layout_job(egui::text::LayoutJob::single_section(upper(text), format)) } /// A `.hud-label`: 11 px Geist Mono, upper case, widely spaced. @@ -60,7 +73,7 @@ pub fn hud_elided(ui: &mut Ui, text: &str, color: Color32, max_width: f32) -> Re extra_letter_spacing: theme::HUD_SPACING, ..Default::default() }; - let mut job = egui::text::LayoutJob::single_section(text.to_uppercase(), format); + let mut job = egui::text::LayoutJob::single_section(upper(text), format); job.wrap = egui::text::TextWrapping::truncate_at_width(max_width.min(ui.available_width()).max(0.0)); let galley = ui.painter().layout_job(job); let elided = galley.elided; @@ -569,3 +582,12 @@ pub fn wordmark_in(ui: &mut Ui, app: &artcraft_launcher_core::CraftApp, size: f3 pub fn heading(text: &str, size: f32, color: Color32) -> RichText { RichText::new(text).size(size).family(theme::display()).color(color).extra_letter_spacing(-0.02 * size) } + +#[cfg(test)] +mod tests { + #[test] + fn upper_leaves_georgian_alone() { + assert_eq!(super::upper("Update all (2)"), "UPDATE ALL (2)"); + assert_eq!(super::upper("ყველას განახლება (2) · ArtCraft"), "ყველას განახლება (2) · ARTCRAFT"); + } +}