Draw Georgian with the system's Georgian font

None of the bundled faces (Inter, Archivo, Geist Mono) has Georgian letters, so Georgian text
would draw as boxes. Georgian joins the CJK languages' mechanism: `Script::Georgian`, and
cjk_font.rs looks for the system's Georgian face — SF Georgian, then Arial Unicode MS on macOS;
Sylfaen on Windows; Noto Sans Georgian or DejaVu Sans on Linux and FreeBSD — and adds it behind
the bundled faces. Nothing is bundled. Where the system has none, and on the web, a Georgian
interface stays in English and Settings says why, as for the CJK languages; the hint now names
Noto Sans Georgian too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMTAbGNRxnMEzRvYnQGphF
This commit is contained in:
Davit MatchakhelidzeandClaude Opus 5.5 committed 2026-10-23 02:16:09 +04:00
1 parent 398dd79332
commit 948d28ab93
4 files changed
+60 -8

No files matched your search

+2 -1
View File
@@ -95,7 +95,8 @@ means adding its row to every catalog marked `complete_menus` (the `*.tsv` files
the English text, never through another catalog. Product and app names (ArtCraft Launcher, Craft
App Suite, PhotoCraft…) stay in English.
A CJK language is drawn with the system's own CJK font (`crates/ui-egui/src/cjk_font.rs`, desktop
only; English where there is none): never bundle a CJK font, they are 10 MB and more.
only; English where there is none): never bundle a CJK font, they are 10 MB and more. Georgian
borrows the system's Georgian font the same way.
### Other rules
+49
View File
@@ -1,6 +1,8 @@
//! A CJK font from the operating system, for the CJK interface languages. The bundled faces have
//! no CJK glyphs, and a CJK font is too large to ship (10 MB or more), so the desktop build
//! borrows the one every system that can show them already has. Desktop only.
//!
//! Georgian, which the bundled faces don't draw either, borrows its system face the same way.
use std::path::{Path, PathBuf};
@@ -40,6 +42,7 @@ fn script_name(script: Script) -> &'static str {
match script {
Script::Chinese => "Chinese",
Script::Japanese => "Japanese",
Script::Georgian => "Georgian",
}
}
@@ -48,6 +51,7 @@ fn script_families(script: Script) -> &'static str {
match script {
Script::Chinese => "PingFang SC, Hiragino Sans GB, Heiti SC, Microsoft YaHei, SimSun, Noto Sans CJK SC and WenQuanYi",
Script::Japanese => "Hiragino Sans, Yu Gothic, Meiryo, MS Gothic, Noto Sans CJK JP, Noto Sans JP, IPAGothic and TakaoGothic",
Script::Georgian => "SF Georgian, Arial Unicode MS, Sylfaen, Noto Sans Georgian and DejaVu Sans",
}
}
@@ -123,6 +127,7 @@ fn candidates(script: Script) -> Vec<Candidate> {
match script {
Script::Chinese => chinese_candidates(),
Script::Japanese => japanese_candidates(),
Script::Georgian => georgian_candidates(),
}
}
@@ -255,6 +260,50 @@ fn japanese_candidates() -> Vec<Candidate> {
out
}
/// Where each system keeps a Georgian font, best first. These faces are small (about 0.1–1 MB),
/// except Arial Unicode MS, which macOS ships too.
fn georgian_candidates() -> Vec<Candidate> {
let mut out = Vec::new();
let mut add = |path: PathBuf, family: &'static str| out.push(Candidate { path, family });
#[cfg(target_os = "macos")]
{
// SF Georgian is the system UI face for Georgian; its family name starts with a dot, as
// macOS's hidden UI faces do.
add("/System/Library/Fonts/SFGeorgian.ttf".into(), ".SF Georgian");
add("/System/Library/Fonts/Supplemental/Arial Unicode.ttf".into(), "Arial Unicode MS");
add("/Library/Fonts/Arial Unicode.ttf".into(), "Arial Unicode MS");
}
#[cfg(target_os = "windows")]
{
let root = std::env::var_os("SystemRoot").map_or_else(|| PathBuf::from(r"C:\Windows"), PathBuf::from);
add(root.join("Fonts").join("sylfaen.ttf"), "Sylfaen");
}
#[cfg(all(unix, not(target_os = "macos")))]
{
// Debian/Ubuntu, Arch, Fedora (static and variable) and FreeBSD's ports.
for path in [
"/usr/share/fonts/truetype/noto/NotoSansGeorgian-Regular.ttf",
"/usr/share/fonts/noto/NotoSansGeorgian-Regular.ttf",
"/usr/share/fonts/google-noto/NotoSansGeorgian-Regular.ttf",
"/usr/share/fonts/google-noto-vf/NotoSansGeorgian[wght].ttf",
"/usr/local/share/fonts/noto/NotoSansGeorgian-Regular.ttf",
] {
add(path.into(), "Noto Sans Georgian");
}
// DejaVu Sans draws Georgian too, and most desktops have it.
for path in [
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
"/usr/share/fonts/TTF/DejaVuSans.ttf",
"/usr/share/fonts/dejavu-sans-fonts/DejaVuSans.ttf",
"/usr/share/fonts/dejavu/DejaVuSans.ttf",
"/usr/local/share/fonts/dejavu/DejaVuSans.ttf",
] {
add(path.into(), "DejaVu Sans");
}
}
out
}
/// `file` in macOS's downloaded font assets:
/// `/System/Library/AssetsV2/com_apple_MobileAsset_Font*/*.asset/AssetData/<file>`.
#[cfg(target_os = "macos")]
+8 -6
View File
@@ -7,17 +7,18 @@ use super::detect::system_lang;
/// The writing system a language is drawn in, and so the system font it needs. Languages that
/// share one can share a face; Simplified and Traditional Chinese do not (they want different
/// faces), so each script is its own. The bundled faces have no CJK glyphs, so a language with a
/// script borrows a system font for it (`crate::theme::cjk_font`).
/// faces), so each script is its own. The bundled faces have no CJK or Georgian glyphs, so a
/// language with a script borrows a system font for it (`crate::theme::cjk_font`).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Script {
Chinese,
Japanese,
Georgian,
}
impl Script {
/// Every script a language can be written in.
pub const ALL: [Script; 2] = [Script::Chinese, Script::Japanese];
pub const ALL: [Script; 3] = [Script::Chinese, Script::Japanese, Script::Georgian];
}
/// One supported UI language.
@@ -29,7 +30,8 @@ pub struct LangInfo {
pub name: &'static str,
/// The language's name in English, shown instead where its own script can't be drawn.
pub english_name: &'static str,
/// The writing system this language is drawn in, or `None` if it needs no system CJK font.
/// The writing system this language is drawn in, or `None` if it needs no system font
/// (CJK, Georgian).
pub script: Option<Script>,
/// Catalog file contents (empty for the built-in English).
pub source: &'static str,
@@ -284,12 +286,12 @@ impl Lang {
self.0.english_name
}
/// Does drawing this language need a CJK font from the system?
/// Does drawing this language need a font from the system (CJK, Georgian)?
pub fn needs_cjk_font(self) -> bool {
self.0.script.is_some()
}
/// The writing system this language is drawn in, if it needs a system CJK font.
/// The writing system this language is drawn in, if it needs a system font.
pub fn script(self) -> Option<Script> {
self.0.script
}
+1 -1
View File
@@ -136,7 +136,7 @@ impl LauncherUi {
if pref.needs_cjk_font() && !theme::cjk_font_available(pref) {
// In English on purpose: the language asked for can't be drawn.
let text = "No font for this language was found on this system, so the interface stays in English. \
Installing one (for example Noto Sans CJK) and restarting fixes it.";
Installing one (for example Noto Sans CJK or Noto Sans Georgian) and restarting fixes it.";
ui.add(egui::Label::new(RichText::new(text).size(12.0).color(t.warn)).wrap());
ui.add_space(14.0);
}