mirror of
https://github.com/storytold/cadcraft.git
synced 2026-10-27 12:27:04 -06:00
The pill under the ViewCube was the text "WCS ⌄". U+2304 is missing from some
UI fonts, so it showed as a box ("WCS □"). The pill now paints the translated
label and a down chevron drawn as lines, in the pill's ink, so it no longer
depends on the font. The catalog key becomes "WCS" in every language; Korean,
which spelled the arrow out as "WCS 선택", is now "WCS" next to the chevron.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
471478868d
commit
0440fa77ff
@@ -2281,10 +2281,18 @@ fn draw_viewcube(app: &mut CadApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
let (c, ring) = (l.center, l.ring);
|
||||
let p = ui.painter_at(rect);
|
||||
crate::viewcube::show(app, ui, &l);
|
||||
// WCS pill.
|
||||
// WCS pill: the label and a down chevron, drawn as lines rather than a "⌄" glyph that a UI
|
||||
// font may lack (it showed as a box, #1541).
|
||||
let pill = Rect::from_center_size(c + vec2(0.0, ring + 26.0), vec2(56.0, 16.0));
|
||||
p.rect_filled(pill, 8.0, Color32::from_rgb(0x48, 0x50, 0x5c));
|
||||
p.text(pill.center(), egui::Align2::CENTER_CENTER, crate::tl!("WCS ⌄"), crate::theme::small(), Tokens::DARK.canvas_ink);
|
||||
let ink = Tokens::DARK.canvas_ink;
|
||||
let label = p.layout_no_wrap(crate::tl!("WCS").to_string(), crate::theme::small(), ink);
|
||||
let (gap, chevron) = (4.0, 6.0);
|
||||
let left = pill.center().x - (label.size().x + gap + chevron) / 2.0;
|
||||
let mid = pill.center().y;
|
||||
p.galley(pos2(left, mid - label.size().y / 2.0), label.clone(), ink);
|
||||
let x = left + label.size().x + gap;
|
||||
p.line(vec![pos2(x, mid - 1.5), pos2(x + chevron / 2.0, mid + 1.5), pos2(x + chevron, mid - 1.5)], Stroke::new(1.2, ink));
|
||||
}
|
||||
|
||||
/// A click on grip `g` (idle): Shift+click makes it hot or cold again; a plain click starts
|
||||
|
||||
@@ -1192,7 +1192,7 @@
|
||||
Viewport {id} إطار العرض {id}
|
||||
Viewports منافذ عرض
|
||||
Volume مستوى الصوت
|
||||
WCS ⌄ WCS ⌄
|
||||
WCS WCS
|
||||
White أبيض
|
||||
Width factor معامل العرض
|
||||
Window نافذة
|
||||
|
||||
|
@@ -1139,7 +1139,7 @@
|
||||
Viewport {id} Výřez {id}
|
||||
Viewports Výřezy
|
||||
W Z
|
||||
WCS ⌄ GSS ⌄
|
||||
WCS GSS
|
||||
White Bílá
|
||||
Width factor Faktor šířky
|
||||
Window Okno
|
||||
|
||||
|
@@ -968,7 +968,7 @@
|
||||
Viewport {id} Ansichtsfenster {id}
|
||||
Viewports Ansichtsfenster
|
||||
W W
|
||||
WCS ⌄ WKS ⌄
|
||||
WCS WKS
|
||||
White Weiß
|
||||
Width factor Breitenfaktor
|
||||
Window Fenster
|
||||
|
||||
|
@@ -1177,7 +1177,7 @@
|
||||
Viewports Ventanas gráficas
|
||||
Volume Volumen
|
||||
W O
|
||||
WCS ⌄ SCU ⌄
|
||||
WCS SCU
|
||||
White Blanco
|
||||
Width factor Factor de anchura
|
||||
Window Ventana
|
||||
|
||||
|
@@ -962,7 +962,7 @@
|
||||
Viewport {id} Fenêtre {id}
|
||||
Viewports Fenêtres
|
||||
W O
|
||||
WCS ⌄ SCG ⌄
|
||||
WCS SCG
|
||||
White Blanc
|
||||
Width factor Facteur de largeur
|
||||
Window Fenêtre
|
||||
|
||||
|
@@ -1142,7 +1142,7 @@ menu Modify Edita
|
||||
Viewport {id} Finestra {id}
|
||||
Viewports Finestre
|
||||
W O
|
||||
WCS ⌄ WCS ⌄
|
||||
WCS WCS
|
||||
White Bianco
|
||||
Width factor Fattore di larghezza
|
||||
Window Finestra
|
||||
|
||||
|
@@ -1138,7 +1138,7 @@
|
||||
Viewport {id} 뷰포트 {id}
|
||||
Viewports 뷰포트
|
||||
W 서
|
||||
WCS ⌄ WCS 선택
|
||||
WCS WCS
|
||||
White 흰색
|
||||
Width factor 폭 비율
|
||||
Window 창
|
||||
|
||||
|
@@ -1177,7 +1177,7 @@
|
||||
Viewports Viewports
|
||||
Volume Volume
|
||||
W O
|
||||
WCS ⌄ SCM ⌄
|
||||
WCS SCM
|
||||
White Branco
|
||||
Width factor Fator de largura
|
||||
Window Janela
|
||||
|
||||
|
@@ -962,7 +962,7 @@
|
||||
Viewport {id} Видовой экран {id}
|
||||
Viewports Видовые экраны
|
||||
W З
|
||||
WCS ⌄ МСК ⌄
|
||||
WCS МСК
|
||||
White Белый
|
||||
Width factor Коэффициент ширины
|
||||
Window Окно
|
||||
|
||||
|
@@ -1176,7 +1176,7 @@
|
||||
Viewports Vyfönster
|
||||
Volume Volym
|
||||
W V
|
||||
WCS ⌄ WCS ⌄
|
||||
WCS WCS
|
||||
White Vit
|
||||
Width factor Breddfaktor
|
||||
Window Fönster
|
||||
|
||||
|
@@ -271,6 +271,36 @@ fn live_switch_to_brazilian_portuguese_translates_the_shell() {
|
||||
assert!(render(&mut app, &ctx).contains("Properties"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_wcs_pill_draws_its_arrow_instead_of_a_glyph_a_font_may_lack() {
|
||||
// #1541: "WCS ⌄" showed a box where the UI font had no "⌄"; the chevron is now drawn as
|
||||
// lines, so no catalog and no language paints the glyph.
|
||||
for (name, catalog) in [
|
||||
("ar", include_str!("ar.tsv")),
|
||||
("cs", include_str!("cs.tsv")),
|
||||
("de", include_str!("de.tsv")),
|
||||
("es", include_str!("es.tsv")),
|
||||
("fr", include_str!("fr.tsv")),
|
||||
("it", include_str!("it.tsv")),
|
||||
("ko", include_str!("ko.tsv")),
|
||||
("pt_br", include_str!("pt_br.tsv")),
|
||||
("ru", include_str!("ru.tsv")),
|
||||
("sv", include_str!("sv.tsv")),
|
||||
("uk", include_str!("uk.tsv")),
|
||||
("zh", include_str!("zh.tsv")),
|
||||
] {
|
||||
assert!(!catalog.contains('\u{2304}'), "{name}.tsv still has the \u{2304} glyph");
|
||||
}
|
||||
let ctx = egui::Context::default();
|
||||
let mut app = CadApp::new(Session::new(), Services::default());
|
||||
for (lang, label) in [("en", "WCS"), ("de", "WKS"), ("ru", "МСК")] {
|
||||
app.run("ui.language", json!({ "lang": lang })).unwrap();
|
||||
let text = render(&mut app, &ctx);
|
||||
assert!(text.lines().any(|l| l == label), "{lang}: the pill reads {label}");
|
||||
assert!(!text.contains('\u{2304}'), "{lang}: no \u{2304} glyph is painted");
|
||||
}
|
||||
}
|
||||
|
||||
fn painted_text(shapes: &[egui::epaint::ClippedShape]) -> String {
|
||||
fn collect(shape: &egui::Shape, text: &mut String) {
|
||||
match shape {
|
||||
@@ -621,7 +651,7 @@ fn korean_representative_translations_remain_available() {
|
||||
("", "Properties", "특성"),
|
||||
("", "Degree", "도 기호"),
|
||||
("", "Style: Standard", "스타일: Standard"),
|
||||
("", "WCS ⌄", "WCS 선택"),
|
||||
("", "WCS", "WCS"),
|
||||
("@plural", "{n} contributor", "기여자 {n}명"),
|
||||
("@plural", "{n} commit", "커밋 {n}개"),
|
||||
] {
|
||||
|
||||
@@ -1179,7 +1179,7 @@
|
||||
Viewport {id} Видовий екран {id}
|
||||
Viewports Видові екрани
|
||||
W Зх
|
||||
WCS ⌄ ССК ⌄
|
||||
WCS ССК
|
||||
White Білий
|
||||
Width factor Коефіцієнт ширини
|
||||
Window Вікно
|
||||
|
||||
|
@@ -963,7 +963,7 @@
|
||||
Viewport {id} 视口 {id}
|
||||
Viewports 视口
|
||||
W W
|
||||
WCS ⌄ WCS ⌄
|
||||
WCS WCS
|
||||
White 白色
|
||||
Width factor 宽度因子
|
||||
Window 窗口
|
||||
|
||||
|
Reference in New Issue
Block a user