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:
parent
cd671cce48
commit
5f93658f0f
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue