diff --git a/CHANGELOG.md b/CHANGELOG.md index bcc129a..9b47ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes are listed here. Versions follow [Semantic Versioning](https ## [Unreleased] +- The moves of the notation and the signs after them are bolder (Ubuntu Medium on the + desktop, a heavier weight on Android), and so are the marks in the circles on the board + (Ubuntu Bold). In Russian the report's rows read «Блестящий» and «Замечательный». + - Android: the dark theme by default (it was the system's); a theme chosen before stays. Android is told the app's own theme, so the window and the splash screen before the app draws match it (no white flash before a dark app on a light phone). diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index c17c9f6..41cc7ba 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -170,3 +170,8 @@ Three evaluation signs (⩲ ⩱ ⌓) come from Noto Sans Math (Copyright 2022 Go cut down to those glyphs: `apps/desktop/assets/fonts/NotoSansMath-nag.ttf`, licence beside it. The figurines of the move notation (♔♕♖♗♘) are the five chess glyphs of egui's emoji-icon-font (MIT), cut out to `apps/desktop/assets/fonts/figurines.ttf`. +The moves of the notation and the move marks on the board are in Ubuntu Medium and Ubuntu +Bold (Ubuntu Font Family 0.83, © 2010–2011 Canonical Ltd., Ubuntu Font Licence 1.0), from +the official release `https://assets.ubuntu.com/v1/fad7939b-ubuntu-font-family-0.83.zip` +(SHA-256 456d7d42…05b42, as in Arch Linux's `ttf-ubuntu-font-family`): +`apps/desktop/assets/fonts/Ubuntu-M.ttf`, `Ubuntu-B.ttf`, licence `UFL.txt` beside them. diff --git a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Board.kt b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Board.kt index ff67d7c..95ab2fa 100644 --- a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Board.kt +++ b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Board.kt @@ -409,7 +409,7 @@ fun Board( drawCircle(Color.White, r, center, style = Stroke(width = sq * 0.025f)) val label = measurer.measure( b.text, - TextStyle(color = Color.White, fontWeight = FontWeight.Bold, fontSize = with(density) { (r * 1.05f).toSp() }), + TextStyle(color = Color.White, fontWeight = FontWeight.Black, fontSize = with(density) { (r * 1.05f).toSp() }), ) drawText(label, topLeft = center - Offset(label.size.width / 2f, label.size.height / 2f)) } diff --git a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt index 0b9ed88..a469cb8 100644 --- a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt +++ b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt @@ -412,15 +412,15 @@ private fun MoveCell( horizontalArrangement = Arrangement.spacedBy(1.dp), ) { val markColor = mark?.takeIf { !selected }?.let { judgementColor(it, chess.dark) } - Text(san(n.san), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = markColor ?: MaterialTheme.colorScheme.onSurface) + Text(san(n.san), fontSize = 17.sp, fontWeight = FontWeight.SemiBold, color = markColor ?: MaterialTheme.colorScheme.onSurface) if (mark != null) { - Text(judgementSymbol(mark), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = markColor ?: MaterialTheme.colorScheme.onSurface) + Text(judgementSymbol(mark), fontSize = 17.sp, fontWeight = FontWeight.Bold, color = markColor ?: MaterialTheme.colorScheme.onSurface) } if (n.nagSymbols.isNotEmpty()) { Text( n.nagSymbols, fontSize = 17.sp, - fontWeight = FontWeight.Medium, + fontWeight = FontWeight.Bold, color = if (selected) { MaterialTheme.colorScheme.onSurface } else { diff --git a/androidApp/app/src/main/res/values-ru/strings.xml b/androidApp/app/src/main/res/values-ru/strings.xml index ea49bdc..c782336 100644 --- a/androidApp/app/src/main/res/values-ru/strings.xml +++ b/androidApp/app/src/main/res/values-ru/strings.xml @@ -257,8 +257,8 @@ Зевки Замечательный ход Блестящий ход - Замечательные ходы - Блестящие ходы + Замечательный + Блестящий Без оценки: %d Анализ прервался Продолжить diff --git a/apps/desktop/assets/fonts/UFL.txt b/apps/desktop/assets/fonts/UFL.txt new file mode 100644 index 0000000..ae78a8f --- /dev/null +++ b/apps/desktop/assets/fonts/UFL.txt @@ -0,0 +1,96 @@ +------------------------------- +UBUNTU FONT LICENCE Version 1.0 +------------------------------- + +PREAMBLE +This licence allows the licensed fonts to be used, studied, modified and +redistributed freely. The fonts, including any derivative works, can be +bundled, embedded, and redistributed provided the terms of this licence +are met. The fonts and derivatives, however, cannot be released under +any other licence. The requirement for fonts to remain under this +licence does not require any document created using the fonts or their +derivatives to be published under this licence, as long as the primary +purpose of the document is not to be a vehicle for the distribution of +the fonts. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this licence and clearly marked as such. This may +include source files, build scripts and documentation. + +"Original Version" refers to the collection of Font Software components +as received under this licence. + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to +a new environment. + +"Copyright Holder(s)" refers to all individuals and companies who have a +copyright ownership of the Font Software. + +"Substantially Changed" refers to Modified Versions which can be easily +identified as dissimilar to the Font Software by users of the Font +Software comparing the Original Version with the Modified Version. + +To "Propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification and with or without charging +a redistribution fee), making available to the public, and in some +countries other activities as well. + +PERMISSION & CONDITIONS +This licence does not grant any rights under trademark law and all such +rights are reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of the Font Software, to propagate the Font Software, subject to +the below conditions: + +1) Each copy of the Font Software must contain the above copyright +notice and this licence. These can be included either as stand-alone +text files, human-readable headers or in the appropriate machine- +readable metadata fields within text or binary files as long as those +fields can be easily viewed by the user. + +2) The font name complies with the following: +(a) The Original Version must retain its name, unmodified. +(b) Modified Versions which are Substantially Changed must be renamed to +avoid use of the name of the Original Version or similar names entirely. +(c) Modified Versions which are not Substantially Changed must be +renamed to both (i) retain the name of the Original Version and (ii) add +additional naming elements to distinguish the Modified Version from the +Original Version. The name of such Modified Versions must be the name of +the Original Version, with "derivative X" where X represents the name of +the new work, appended to that name. + +3) The name(s) of the Copyright Holder(s) and any contributor to the +Font Software shall not be used to promote, endorse or advertise any +Modified Version, except (i) as required by this licence, (ii) to +acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with +their explicit written permission. + +4) The Font Software, modified or unmodified, in part or in whole, must +be distributed entirely under this licence, and must not be distributed +under any other licence. The requirement for fonts to remain under this +licence does not affect any document created using the Font Software, +except any version of the Font Software extracted from a document +created using the Font Software may only be distributed under this +licence. + +TERMINATION +This licence becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. diff --git a/apps/desktop/assets/fonts/Ubuntu-B.ttf b/apps/desktop/assets/fonts/Ubuntu-B.ttf new file mode 100644 index 0000000..b173da2 Binary files /dev/null and b/apps/desktop/assets/fonts/Ubuntu-B.ttf differ diff --git a/apps/desktop/assets/fonts/Ubuntu-M.ttf b/apps/desktop/assets/fonts/Ubuntu-M.ttf new file mode 100644 index 0000000..ca9c03a Binary files /dev/null and b/apps/desktop/assets/fonts/Ubuntu-M.ttf differ diff --git a/apps/desktop/src/assets.rs b/apps/desktop/src/assets.rs index 7477e52..8feff03 100644 --- a/apps/desktop/src/assets.rs +++ b/apps/desktop/src/assets.rs @@ -156,6 +156,20 @@ pub fn install(ctx: &egui::Context) { ctx.set_fonts(font_definitions()); } +/// The font families of the heavier faces. +pub const MEDIUM: &str = "ubuntu-medium"; +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). +pub fn bold(size: f32) -> egui::FontId { + egui::FontId::new(size, egui::FontFamily::Name(BOLD.into())) +} + /// 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 @@ -181,7 +195,34 @@ pub fn font_definitions() -> egui::FontDefinitions { ), ), ); - for family in [egui::FontFamily::Proportional, egui::FontFamily::Monospace] { + // The heavier faces 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 + .families + .insert(egui::FontFamily::Name(name.into()), list); + } + 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) { list.insert(1, "figurine".into()); } @@ -191,7 +232,12 @@ pub fn font_definitions() -> egui::FontDefinitions { .get(&egui::FontFamily::Monospace) .and_then(|f| f.first()) .cloned(); - for family in [egui::FontFamily::Proportional, egui::FontFamily::Monospace] { + 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) { if let Some(m) = &mono && !list.contains(m) diff --git a/apps/desktop/src/board.rs b/apps/desktop/src/board.rs index 3b9979a..b1c79bf 100644 --- a/apps/desktop/src/board.rs +++ b/apps/desktop/src/board.rs @@ -469,7 +469,7 @@ impl BoardView<'_> { c, egui::Align2::CENTER_CENTER, b.text, - egui::FontId::proportional(radius * 1.05), + crate::assets::bold(radius * 1.05), Color32::WHITE, ); } diff --git a/apps/desktop/src/i18n.rs b/apps/desktop/src/i18n.rs index c020f7a..3b2e0c0 100644 --- a/apps/desktop/src/i18n.rs +++ b/apps/desktop/src/i18n.rs @@ -10036,7 +10036,7 @@ const ROWS: &[[&str; 9]] = &[ ], [ "Brilliant moves", - "Блестящие ходы", + "Блестящий", "Coups brillants", "Brillante Züge", "Jugadas brillantes", @@ -10047,7 +10047,7 @@ const ROWS: &[[&str; 9]] = &[ ], [ "Great moves", - "Замечательные ходы", + "Замечательный", "Excellents coups", "Starke Züge", "Grandes jugadas", diff --git a/apps/desktop/src/notation.rs b/apps/desktop/src/notation.rs index a300b9d..1762783 100644 --- a/apps/desktop/src/notation.rs +++ b/apps/desktop/src/notation.rs @@ -602,7 +602,7 @@ fn paint_move_cell( cell.left_center() + vec2(10.0, 0.0), Align2::LEFT_CENTER, format!("{san}{sym}"), - FontId::proportional(16.0), + crate::assets::medium(16.0), text_color, ) .right()