Notation: moves in Ubuntu Bold (desktop) and bold (Android); Medium dropped
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

The designer compared JetBrains Mono: in a monospace face !! and ?? fall apart
and O-O-O reads as 0-0-0; the Ubuntu family stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-28 03:04:55 +03:00
parent 1f27c2ae57
commit df59ff1b32
6 changed files with 25 additions and 37 deletions

View file

@ -156,16 +156,10 @@ pub fn install(ctx: &egui::Context) {
ctx.set_fonts(font_definitions());
}
/// The font families of the heavier faces.
pub const MEDIUM: &str = "ubuntu-medium";
/// The font family of the bold face.
pub const BOLD: &str = "ubuntu-bold";
/// A font of the medium face (the moves of the notation).
pub fn medium(size: f32) -> egui::FontId {
egui::FontId::new(size, egui::FontFamily::Name(MEDIUM.into()))
}
/// A font of the bold face (the marks on the board).
/// A font of the bold face (the moves of the notation, the marks on the board).
pub fn bold(size: f32) -> egui::FontId {
egui::FontId::new(size, egui::FontFamily::Name(BOLD.into()))
}
@ -195,32 +189,28 @@ pub fn font_definitions() -> egui::FontDefinitions {
),
),
);
// The heavier faces of the same family (egui's text is Ubuntu Light): the moves of the
// The bold face of the same family (egui's text is Ubuntu Light): the moves of the
// notation and the marks on the board.
for (name, bytes) in [
(MEDIUM, &include_bytes!("../assets/fonts/Ubuntu-M.ttf")[..]),
(BOLD, &include_bytes!("../assets/fonts/Ubuntu-B.ttf")[..]),
] {
fonts.font_data.insert(
name.into(),
std::sync::Arc::new(egui::FontData::from_static(bytes)),
);
let mut list = vec![name.to_string()];
list.extend(
fonts
.families
.get(&egui::FontFamily::Proportional)
.cloned()
.unwrap_or_default(),
);
fonts.font_data.insert(
BOLD.into(),
std::sync::Arc::new(egui::FontData::from_static(include_bytes!(
"../assets/fonts/Ubuntu-B.ttf"
))),
);
let mut bold = vec![BOLD.to_string()];
bold.extend(
fonts
.families
.insert(egui::FontFamily::Name(name.into()), list);
}
.get(&egui::FontFamily::Proportional)
.cloned()
.unwrap_or_default(),
);
fonts
.families
.insert(egui::FontFamily::Name(BOLD.into()), bold);
for family in [
egui::FontFamily::Proportional,
egui::FontFamily::Monospace,
egui::FontFamily::Name(MEDIUM.into()),
egui::FontFamily::Name(BOLD.into()),
] {
if let Some(list) = fonts.families.get_mut(&family) {
@ -235,7 +225,6 @@ pub fn font_definitions() -> egui::FontDefinitions {
for family in [
egui::FontFamily::Proportional,
egui::FontFamily::Monospace,
egui::FontFamily::Name(MEDIUM.into()),
egui::FontFamily::Name(BOLD.into()),
] {
if let Some(list) = fonts.families.get_mut(&family) {