1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-26 07:22:45 +00:00

Fix of fix textscript encoding [ci skip]

This commit is contained in:
biroder 2023-04-13 18:02:41 +03:00 committed by GitHub
parent cd671cce48
commit 5f93658f0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,9 +409,11 @@ impl SharedGameState {
constants.load_locales(ctx)?; constants.load_locales(ctx)?;
let locale = SharedGameState::get_locale(&constants, &settings.locale).unwrap_or_default(); let locale = SharedGameState::get_locale(&constants, &settings.locale).unwrap_or_default();
if locale.code != "jp" { constants.textscript.encoding = if locale.code == "jp" && !constants.is_switch {
constants.textscript.encoding = TextScriptEncoding::UTF8; TextScriptEncoding::ShiftJIS
} } else {
TextScriptEncoding::UTF8
};
let font = BMFont::load(&constants.base_paths, &locale.font.path, ctx, locale.font.scale).or_else(|e| { let font = BMFont::load(&constants.base_paths, &locale.font.path, ctx, locale.font.scale).or_else(|e| {
log::warn!("Failed to load font, using built-in: {}", e); log::warn!("Failed to load font, using built-in: {}", e);
@ -559,9 +561,11 @@ impl SharedGameState {
pub fn update_locale(&mut self, ctx: &mut Context) { pub fn update_locale(&mut self, ctx: &mut Context) {
if let Some(locale) = SharedGameState::get_locale(&self.constants, &self.settings.locale) { if let Some(locale) = SharedGameState::get_locale(&self.constants, &self.settings.locale) {
self.loc = locale; self.loc = locale;
if self.loc.code != "jp" { self.constants.textscript.encoding = if self.loc.code == "jp" && !self.constants.is_switch {
self.constants.textscript.encoding = TextScriptEncoding::UTF8; TextScriptEncoding::ShiftJIS
} } else {
TextScriptEncoding::UTF8
};
} }
let font = BMFont::load(&self.constants.base_paths, &self.loc.font.path, ctx, self.loc.font.scale) let font = BMFont::load(&self.constants.base_paths, &self.loc.font.path, ctx, self.loc.font.scale)