From 1ae5ecdbbf63b7254bdd7104c6e6e9901dac77a6 Mon Sep 17 00:00:00 2001 From: Alula <6276139+alula@users.noreply.github.com> Date: Sun, 16 Jan 2022 02:45:17 +0100 Subject: [PATCH] fix CS+ font rendering inaccuracies --- src/bmfont_renderer.rs | 6 +++--- src/engine_constants/mod.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bmfont_renderer.rs b/src/bmfont_renderer.rs index 0c63d86..18e714c 100644 --- a/src/bmfont_renderer.rs +++ b/src/bmfont_renderer.rs @@ -57,7 +57,7 @@ impl BMFontRenderer { for chr in iter { if let Some(glyph) = self.font.chars.get(&chr) { offset_x += ((glyph.width as f32 + glyph.xoffset as f32) * constants.font_scale).floor() - + if chr != ' ' { 1.0 } else { constants.font_space_offset }; + + if chr != ' ' { constants.font_scale } else { constants.font_space_offset }; } } @@ -140,7 +140,7 @@ impl BMFontRenderer { ); offset_x += ((glyph.width as f32 + glyph.xoffset as f32) * constants.font_scale).floor() - + if chr != ' ' { 1.0 } else { constants.font_space_offset }; + + if chr != ' ' { constants.font_scale } else { constants.font_space_offset }; } } @@ -180,7 +180,7 @@ impl BMFontRenderer { offset_x += scale * (((glyph.width as f32 + glyph.xoffset as f32) * constants.font_scale).floor() - + if *chr != ' ' { 1.0 } else { constants.font_space_offset }); + + if *chr != ' ' { constants.font_scale } else { constants.font_space_offset }); } batch.draw(ctx)?; diff --git a/src/engine_constants/mod.rs b/src/engine_constants/mod.rs index ff98bf1..2ea35a9 100644 --- a/src/engine_constants/mod.rs +++ b/src/engine_constants/mod.rs @@ -1529,7 +1529,7 @@ impl EngineConstants { self.title.logo_rect = Rect { left: 0, top: 0, right: 214, bottom: 50 }; self.font_path = "csfont.fnt".to_owned(); self.font_scale = 0.5; - self.font_space_offset = 2.0; + self.font_space_offset = 3.0; self.soundtracks.insert("Remastered".to_owned(), "/base/Ogg11/".to_owned()); self.soundtracks.insert("New".to_owned(), "/base/Ogg/".to_owned());