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:
parent
87792972d0
commit
1ae5ecdbbf
|
|
@ -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)?;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue