From a857644f0ca55ad955ec0cbb2df1f18106dfce02 Mon Sep 17 00:00:00 2001 From: Elias Miettinen Date: Wed, 4 Nov 2026 22:34:51 +0200 Subject: [PATCH 1/2] match the ; more to the original : style --- crates/realm-proto/src/lib.rs | 4 ++-- crates/render/src/font.rs | 42 ++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/crates/realm-proto/src/lib.rs b/crates/realm-proto/src/lib.rs index a613b2d..ff7bc15 100644 --- a/crates/realm-proto/src/lib.rs +++ b/crates/realm-proto/src/lib.rs @@ -34,8 +34,8 @@ pub const TRANSFER_SECONDS: u64 = 10; pub const MAX_LOBBIES: usize = 1000; /// Whether a lobby's name may have this char: the ones the discs' fonts have, which show a name as -/// the menus do, and a space. (Letters are capitals there, whatever their case.) Not `#`, `(`, `)`, `[` -/// and `]`, which the middle font has since been given: older builds could not draw them. The +/// the menus do, and a space. (Letters are capitals there, whatever their case.) Not `#`, `(`, `)`, `[`, +/// `]`, `"` and `;`, which the middle font has since been given: older builds could not draw them. The /// client's tests keep this equal to `render::font::in_original_fonts`. pub fn is_name_char(c: char) -> bool { c == ' ' diff --git a/crates/render/src/font.rs b/crates/render/src/font.rs index 2b8b1a4..c327cd5 100644 --- a/crates/render/src/font.rs +++ b/crates/render/src/font.rs @@ -43,7 +43,7 @@ impl Font { } /// The glyphs that the disc's font does not have and [`FontAtlas::new`] draws itself, after - /// the disc's: `#`, `(`, `)`, `[` and `]` in the middle font, none in the large one. + /// the disc's: `#`, `(`, `)`, `[`, `]`, `"` and `;` in the middle font, none in the large one. const fn own_glyphs(self) -> &'static [[&'static str; 8]] { match self { Font::Large => &[], @@ -74,10 +74,12 @@ const OPEN: usize = OWN + 1; const CLOSE: usize = OWN + 2; const OPEN_BRACKET: usize = OWN + 3; const CLOSE_BRACKET: usize = OWN + 4; +const QUOTE: usize = OWN + 5; +const SEMICOLON: usize = OWN + 6; -/// The middle font's own glyphs (`#`, `(`, `)`, `[` and `]`), drawn in the style of its `H`, `=` and `/`: +/// The middle font's own glyphs (`#`, `(`, `)`, `[`, `]`, `"` and `;`), drawn in the style of its `H`, `=` and `/`: /// `.` is transparent, `o` the outline and `#` the fill. -const OWN_MIDDLE: [[&str; 8]; 5] = [ +const OWN_MIDDLE: [[&str; 8]; 7] = [ [ "..ooooooo...", "ooo##o##ooo.", @@ -128,6 +130,26 @@ const OWN_MIDDLE: [[&str; 8]; 5] = [ "ooooo.", "......", ], + [ + "ooooo.", + "o#o#o.", + "o#o#o.", + "ooooo.", + "......", + "......", + "......", + "......", + ], + [ + "......", + "......", + "ooooo.", + "o###o.", + "ooooo.", + "o###o.", + "oo##o.", + ".oooo.", + ], ]; /// The outline and fill texels of the discs' fonts, as RGBA. @@ -155,6 +177,8 @@ pub fn glyph(c: char) -> Option { ')' => CLOSE, '[' => OPEN_BRACKET, ']' => CLOSE_BRACKET, + '"' => QUOTE, + ';' => SEMICOLON, '?' => QUESTION, '_' => 47, '/' => 48, @@ -164,14 +188,14 @@ pub fn glyph(c: char) -> Option { /// Whether text in `font` can show this character: a space, or one that has a glyph, whether from /// the disc or one that [`FontAtlas::new`] draws itself (which the large font has none of: it shows -/// `?` for `#`, `(`, `)`, `[` and `]`). What the in-game text (toasts) is checked against: text with a +/// `?` for `#`, `(`, `)`, `[`, `]`, `"` and `;`). What the in-game text (toasts) is checked against: text with a /// character that fails this is written in Bevy's font. pub fn drawable(font: Font, c: char) -> bool { c == ' ' || glyph(c).is_some_and(|i| i < OWN + font.own_glyphs().len()) } /// Whether the discs' fonts have the character: [`drawable`] in any font, without the glyphs that -/// [`FontAtlas::new`] draws itself (`#`, `(`, `)`, `[` and `]`). What a lobby name is made of, because the +/// [`FontAtlas::new`] draws itself (`#`, `(`, `)`, `[`, `]`, `"` and `;`). What a lobby name is made of, because the /// realm and the builds that join through it were made before those glyphs: a name with one /// would show as `?` there. `realm_proto::is_name_char` is this, which the client's tests check. pub fn in_original_fonts(c: char) -> bool { @@ -425,8 +449,10 @@ mod tests { assert_eq!(glyph(')'), Some(CLOSE)); assert_eq!(glyph('['), Some(OPEN_BRACKET)); assert_eq!(glyph(']'), Some(CLOSE_BRACKET)); + assert_eq!(glyph('"'), Some(QUOTE)); + assert_eq!(glyph(';'), Some(SEMICOLON)); // The glyphs of its own are drawable but not in the original fonts; a space is both. - for c in ['#', '(', ')', '[', ']'] { + for c in ['#', '(', ')', '[', ']', '"', ';'] { assert!(drawable(Font::Middle, c) && !in_original_fonts(c), "{c:?}"); assert!(!drawable(Font::Large, c), "{c:?}"); } @@ -467,8 +493,8 @@ mod tests { return; }; for atlas in &fonts { - // The disc's 57, and the middle font's own `#`, `(`, `)`, `[` and `]`. - let own = if atlas.font() == Font::Middle { 5 } else { 0 }; + // The disc's 57, and the middle font's own `#`, `(`, `)`, `[`, `]`, `"` and `;`. + let own = if atlas.font() == Font::Middle { 7 } else { 0 }; assert_eq!(atlas.glyphs().len(), OWN + own, "{:?}", atlas.font()); // Every digit and letter has texels, and is no wider than its cell. for glyph in &atlas.glyphs()[..36] { From 0357af13af8fb531295a21ac9f3f5bdd79aafebc Mon Sep 17 00:00:00 2001 From: Elias Miettinen Date: Wed, 4 Nov 2026 22:37:56 +0200 Subject: [PATCH 2/2] a more matching one :) --- crates/render/src/font.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/render/src/font.rs b/crates/render/src/font.rs index c327cd5..7eef5e5 100644 --- a/crates/render/src/font.rs +++ b/crates/render/src/font.rs @@ -131,14 +131,14 @@ const OWN_MIDDLE: [[&str; 8]; 7] = [ "......", ], [ - "ooooo.", - "o#o#o.", - "o#o#o.", - "ooooo.", - "......", - "......", - "......", - "......", + "ooooooooo.", + "o###o###o.", + "oo##oo##o.", + ".o##oo##o.", + ".oooooooo.", + "..........", + "..........", + "..........", ], [ "......",