mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 12:17:14 -06:00
Fix #81: Chinese, Japanese and Korean names show in the UI, not boxes
Layer and object names, document tabs and any other UI text in scripts the UI fonts lack now draw in an installed font that covers them, as the canvas already did. Root cause: egui only had the bundled UI fonts (Source Sans 3, JetBrains Mono) and its defaults, none with CJK glyphs. After each frame the UI now looks at the text it painted; the first time a character the UI fonts lack appears, a thread finds an installed font covering it through the font database (the canvas's fallback search, so a font the canvas loaded is reused, its bytes shared rather than copied) and adds it to every egui family as the last fallback. Nothing is bundled, Latin-only UIs load no extra font, and on the web, without system fonts, the boxes remain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f12428264c
commit
c4b87e36b2
@@ -675,6 +675,13 @@ impl FontDb {
|
||||
None
|
||||
}
|
||||
|
||||
/// A face that covers `c`, for text drawn outside the canvas (the app's own UI): the loaded
|
||||
/// fonts first, then (native) an installed one, loaded on demand. Characters no font covers
|
||||
/// are remembered, so they are looked for once.
|
||||
pub fn face_covering(&self, c: char) -> Option<Arc<FontFace>> {
|
||||
self.fallback_for(c, 0)
|
||||
}
|
||||
|
||||
fn loaded_fallback(&self, c: char, exclude: u32) -> Option<Arc<FontFace>> {
|
||||
let faces = self.read_faces();
|
||||
let mut order: Vec<&Arc<FontFace>> = faces.iter().filter(|f| f.id != exclude).collect();
|
||||
|
||||
Reference in New Issue
Block a user