Website: new features and fresh screenshots; no missing glyphs in the app

The site lists the reference tab, games from Lichess and Chess.com, translated
comments and self-update, and the notation and animation under "Make it
yours", in six languages. Thirteen screenshots (three new: reference,
translation, online games) on the owner's green board with Merida pieces, the
"looks" one on another board. The translation shot shows a real ChatGPT
translation of our own German comments to Reti-Tartakower 1910, put into the
screenshot cache once (shots/translate-for-shots.py); the shots send nothing.

The app: "✕" next to the Chess.com nickname, "⌂" in board search and "✓" in
translation texts had no glyph (empty boxes): replaced by the bundled 🗙, 🏠
and ✔. A test now checks every character of the translations and the string
literals against the character maps of the bundled fonts. The online games dev
hook takes two nicknames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-21 23:47:14 +03:00
parent 6e8420a45c
commit 005601afb2
148 changed files with 456 additions and 186 deletions

View file

@ -153,6 +153,11 @@ pub fn install(ctx: &egui::Context) {
for (name, bytes) in TEXTURES {
ctx.include_bytes(format!("bytes://boards/{name}"), *bytes);
}
ctx.set_fonts(font_definitions());
}
/// egui's fonts with ours added: figurines for the move notation, then the fallbacks.
pub fn font_definitions() -> egui::FontDefinitions {
// Arrows (→ ⇄ ↔) are only in egui's monospace font, and three evaluation signs
// (⩲ ⩱ ⌓) in none: the last fallbacks of the text.
let mut fonts = egui::FontDefinitions::default();
@ -196,7 +201,7 @@ pub fn install(ctx: &egui::Context) {
list.push("nag-symbols".into());
}
}
ctx.set_fonts(fonts);
fonts
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]

View file

@ -138,7 +138,7 @@ impl SearchBoard {
chess_import::position::key(&self.position())
}
/// "1.e4 c5 2.Nf3 d6" (with "⌂" before a start taken from a game).
/// "1.e4 c5 2.Nf3 d6" (with "🏠" before a start taken from a game).
fn san_line(&self, upto: usize) -> Vec<(String, usize)> {
let mut pos = self.start.clone();
let mut out = Vec::new();
@ -166,7 +166,11 @@ impl SearchBoard {
/// Text of the position chip: the moves up to 8 half-moves, then "after 14…Nf6".
pub fn chip_text(&self) -> String {
let moves = self.san_line(self.cursor);
let prefix = if self.start_fen.is_some() { "⌂ " } else { "" };
let prefix = if self.start_fen.is_some() {
"🏠 "
} else {
""
};
if moves.len() <= 8 {
let text: Vec<String> = moves
.into_iter()
@ -541,7 +545,7 @@ impl SearchBoard {
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing.x = 4.0;
if self.start_fen.is_some() {
ui.label("⌂").on_hover_text(format!(
ui.label("🏠").on_hover_text(format!(
"{}\n{}",
tr("Start position of the game"),
self.start_fen.clone().unwrap_or_default()

View file

@ -221,7 +221,7 @@ impl Drop for SignIn {
fn page(ok: bool) -> String {
let (title, text) = if ok {
(
crate::i18n::tr("✓ You are signed in to ChatGPT"),
crate::i18n::tr("✔ You are signed in to ChatGPT"),
crate::i18n::tr(
"Go back to ChessPenguin — the translation goes on there. You can close this tab.",
),

View file

@ -1256,12 +1256,12 @@ const ROWS: &[[&str; 6]] = &[
"Come {service} conserva i dati: informativa sulla privacy ↗",
],
[
"✓ Works: “{sample}” → “{result}”",
"✓ Работает: «{sample}» → «{result}»",
"✓ Fonctionne : « {sample} » → « {result} »",
"✓ Funktioniert: „{sample}“ → „{result}“",
"✓ Funciona: «{sample}» → «{result}»",
"✓ Funziona: «{sample}» → «{result}»",
"✔ Works: “{sample}” → “{result}”",
"✔ Работает: «{sample}» → «{result}»",
"✔ Fonctionne : « {sample} » → « {result} »",
"✔ Funktioniert: „{sample}“ → „{result}“",
"✔ Funciona: «{sample}» → «{result}»",
"✔ Funziona: «{sample}» → «{result}»",
],
[
"As the interface ({lang})",
@ -1296,12 +1296,12 @@ const ROWS: &[[&str; 6]] = &[
"Hai effettuato l’accesso: {account}",
],
[
"✓ Works, model {model}",
"✓ Работает, модель {model}",
"✓ Fonctionne, modèle {model}",
"✓ Funktioniert, Modell {model}",
"✓ Funciona, modelo {model}",
"✓ Funziona, modello {model}",
"✔ Works, model {model}",
"✔ Работает, модель {model}",
"✔ Fonctionne, modèle {model}",
"✔ Funktioniert, Modell {model}",
"✔ Funciona, modelo {model}",
"✔ Funziona, modello {model}",
],
[
"Get a key on the {service} website ↗",
@ -1432,12 +1432,12 @@ const ROWS: &[[&str; 6]] = &[
"Tradotti: {n} di {total}",
],
[
"✓ You are signed in to ChatGPT",
"✓ Вы вошли в ChatGPT",
"✓ Vous êtes connecté à ChatGPT",
"✓ Sie sind bei ChatGPT angemeldet",
"✓ Ha iniciado sesión en ChatGPT",
"✓ Hai effettuato l’accesso a ChatGPT",
"✔ You are signed in to ChatGPT",
"✔ Вы вошли в ChatGPT",
"✔ Vous êtes connecté à ChatGPT",
"✔ Sie sind bei ChatGPT angemeldet",
"✔ Ha iniciado sesión en ChatGPT",
"✔ Hai effettuato l’accesso a ChatGPT",
],
[
"Go back to ChessPenguin — the translation goes on there. You can close this tab.",
@ -5848,6 +5848,79 @@ mod tests {
assert_eq!(Lang::from_locales(Vec::<String>::new()), Lang::En);
}
/// Every character the interface shows — the translations in all languages and the
/// string literals of the sources — has a glyph in the bundled fonts (no empty boxes).
#[test]
fn every_shown_character_has_a_glyph() {
let sources = [
include_str!("app.rs"),
include_str!("assets.rs"),
include_str!("analysis.rs"),
include_str!("game_view.rs"),
include_str!("library.rs"),
include_str!("large_db.rs"),
include_str!("board_search.rs"),
include_str!("engine_offer.rs"),
include_str!("notation.rs"),
include_str!("review.rs"),
include_str!("engines.rs"),
include_str!("examples.rs"),
include_str!("settings.rs"),
include_str!("settings_ui.rs"),
include_str!("widgets.rs"),
include_str!("reference.rs"),
include_str!("online.rs"),
include_str!("online_ui.rs"),
include_str!("update.rs"),
include_str!("update_ui.rs"),
include_str!("report.rs"),
include_str!("board.rs"),
include_str!("engine_download.rs"),
include_str!("main.rs"),
include_str!("graphics.rs"),
include_str!("translate.rs"),
include_str!("translate_ui.rs"),
include_str!("chatgpt.rs"),
include_str!("san.rs"),
];
let mut chars = std::collections::BTreeSet::new();
for row in ROWS {
for text in row.iter() {
chars.extend(text.chars());
}
}
for src in sources {
for line in src.lines().filter(|l| !l.trim_start().starts_with("//")) {
// The parts of the line inside double quotes.
for (i, part) in line.split('"').enumerate() {
if i % 2 == 1 {
chars.extend(part.chars());
}
}
}
}
// The characters each font of the text has (egui's own check cannot tell a
// glyph of its last fallback from the replacement box).
let fonts = crate::assets::font_definitions();
let maps: Vec<std::collections::HashSet<u32>> = fonts.families
[&egui::FontFamily::Proportional]
.iter()
.map(|name| {
use skrifa::MetadataProvider as _;
let data = &fonts.font_data[name];
let font = skrifa::FontRef::new(&data.font).expect("a font");
font.charmap().mappings().map(|(c, _)| c).collect()
})
.collect();
let missing: Vec<String> = chars
.into_iter()
.filter(|c| !c.is_ascii() && !c.is_whitespace() && *c != '\u{fe0f}')
.filter(|c| !maps.iter().any(|m| m.contains(&(*c as u32))))
.map(|c| format!("{c} U+{:04X}", c as u32))
.collect();
assert!(missing.is_empty(), "no glyph for: {missing:?}");
}
/// Every `tr("…")` / `trf("…"` key used in the sources must have a translation row.
#[test]
fn all_used_keys_are_translated() {

View file

@ -171,13 +171,19 @@ impl OnlineDialog {
self.open = true;
}
/// Dev hook: `CP_ONLINE=<nick>` opens the window and looks the nickname up,
/// `CP_ONLINE_DOWNLOAD=1` then downloads (screenshots, manual checks).
/// Dev hook: `CP_ONLINE=<nick>` (`<lichess>,<chess.com>` for two nicknames) opens the
/// window and looks the nickname up, `CP_ONLINE_DOWNLOAD=1` then downloads
/// (screenshots, manual checks).
pub fn from_env() -> OnlineDialog {
let mut d = OnlineDialog::default();
if let Ok(nick) = std::env::var("CP_ONLINE") {
d.open = true;
let (nick, other) = match nick.split_once(',') {
Some((a, b)) => (a.to_owned(), Some(b.to_owned())),
None => (nick, None),
};
d.nick = nick;
d.other = other;
d.pick = [true, true];
d.auto_find = true;
d.auto_download = std::env::var("CP_ONLINE_DOWNLOAD").is_ok();
@ -378,7 +384,7 @@ impl OnlineDialog {
clear |= r.changed();
enter |= r.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter));
same = ui
.small_button("✕")
.small_button("🗙")
.on_hover_text(tr("The same nickname"))
.clicked();
});

View file

@ -1288,7 +1288,16 @@ mod tests {
#[test]
#[ignore = "prints the instructions for a manual check"]
fn print_instructions() {
println!("{}", instructions(Lang::Ru));
// TRANSLATE_LANG=en|ru|fr|de|es|it (Russian by default).
let lang = match std::env::var("TRANSLATE_LANG").as_deref() {
Ok("en") => Lang::En,
Ok("fr") => Lang::Fr,
Ok("de") => Lang::De,
Ok("es") => Lang::Es,
Ok("it") => Lang::It,
_ => Lang::Ru,
};
println!("{}", instructions(lang));
}
#[test]

View file

@ -869,7 +869,7 @@ impl Hub {
match &self.check_result {
Some(Ok(t)) => {
ui.label(trf(
"✓ Works: “{sample}” → “{result}”",
"✔ Works: “{sample}” → “{result}”",
&[("sample", &translate::sample(s.target())), ("result", t)],
));
}
@ -1108,7 +1108,7 @@ impl Hub {
let warn = ui.visuals().warn_fg_color;
match &self.chatgpt {
ChatGptState::Works(m) => {
ui.label(trf("✓ Works, model {model}", &[("model", m)]));
ui.label(trf("✔ Works, model {model}", &[("model", m)]));
}
ChatGptState::NoPlan => {
ui.horizontal_wrapped(|ui| {
@ -1306,7 +1306,7 @@ impl Hub {
match r {
Ok(t) => {
ui.label(trf(
"✓ Works: “{sample}” → “{result}”",
"✔ Works: “{sample}” → “{result}”",
&[("sample", &translate::sample(s.target())), ("result", t)],
));
}