From d0524b10110104baafcdc1ec385c3d57bc5ef901 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 20 Oct 2025 19:29:15 -0700 Subject: [PATCH] try jp --- selfdrive/assets/fonts/NotoSansJP-Regular.ttf | 3 ++ system/ui/lib/application.py | 35 +++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 selfdrive/assets/fonts/NotoSansJP-Regular.ttf diff --git a/selfdrive/assets/fonts/NotoSansJP-Regular.ttf b/selfdrive/assets/fonts/NotoSansJP-Regular.ttf new file mode 100644 index 0000000000..6df2f0a66e --- /dev/null +++ b/selfdrive/assets/fonts/NotoSansJP-Regular.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f32915916d2d6f35bb0d3d7ef0784504914bf0235afb02eec552bd14d06d3552 +size 5450308 diff --git a/system/ui/lib/application.py b/system/ui/lib/application.py index aeeadcebb4..17cd4cabb5 100644 --- a/system/ui/lib/application.py +++ b/system/ui/lib/application.py @@ -41,15 +41,15 @@ FONT_DIR = ASSETS_DIR.joinpath("fonts") class FontWeight(StrEnum): - THIN = "Inter-Thin.ttf" - EXTRA_LIGHT = "Inter-ExtraLight.ttf" - LIGHT = "Inter-Light.ttf" - NORMAL = "Inter-Regular.ttf" - MEDIUM = "Inter-Medium.ttf" - SEMI_BOLD = "Inter-SemiBold.ttf" - BOLD = "Inter-Bold.ttf" - EXTRA_BOLD = "Inter-ExtraBold.ttf" - BLACK = "Inter-Black.ttf" + THIN = "NotoSansJP-Regular.ttf" + EXTRA_LIGHT = "NotoSansJP-Regular.ttf" + LIGHT = "NotoSansJP-Regular.ttf" + NORMAL = "NotoSansJP-Regular.ttf" + MEDIUM = "NotoSansJP-Regular.ttf" + SEMI_BOLD = "NotoSansJP-Regular.ttf" + BOLD = "NotoSansJP-Regular.ttf" + EXTRA_BOLD = "NotoSansJP-Regular.ttf" + BLACK = "NotoSansJP-Regular.ttf" @dataclass @@ -353,8 +353,23 @@ class GuiApplication: all_chars = set() for layout in KEYBOARD_LAYOUTS.values(): all_chars.update(key for row in layout for key in row) + + # Ensure Japanese scripts and typical punctuation/fullwidth forms are loaded for NotoSansJP + jp_ranges = [ + (0x3000, 0x303F), # CJK Symbols and Punctuation + (0x3040, 0x309F), # Hiragana + (0x30A0, 0x30FF), # Katakana + (0x31F0, 0x31FF), # Katakana Phonetic Extensions + (0xFF00, 0xFFEF), # Halfwidth and Fullwidth Forms + (0x4E00, 0x9FFF), # CJK Unified Ideographs (basic block) + ] + for start, end in jp_ranges: + all_chars.update(chr(cp) for cp in range(start, end + 1)) + + # Keep common UI symbols + all_chars.update(list("–✓×°§•")) + all_chars = "".join(all_chars) - all_chars += "–✓×°§•" codepoint_count = rl.ffi.new("int *", 1) codepoints = rl.load_codepoints(all_chars, codepoint_count)