1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-11-29 15:56:53 +00:00

fix CS+ font rendering inaccuracies

This commit is contained in:
Alula 2022-01-16 02:45:17 +01:00
parent 87792972d0
commit 1ae5ecdbbf
No known key found for this signature in database
GPG key ID: 3E00485503A1D8BA
2 changed files with 4 additions and 4 deletions

View file

@ -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)?;

View file

@ -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());