Skip to content

Commit

Permalink
maybe fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Nov 27, 2024
1 parent 0d97bc2 commit a30b399
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions source/backend/Localization.hx
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,16 @@ class Localization {
return path;
}

public static function loadCustomFont(language:String):String {
var path:String = Paths.file('languages/fonts/' + language + '.ttf');
private static function loadCustomFont(language:String):String {
var target:String = language != null ? language : currentLanguage;
var path:String = Paths.file('languages/fonts/' + target + '.ttf');
if (Paths.exists(path)) {
trace('custom font loaded for $language: $path');
return customFontPath = path;
}

return null;
trace('no custom font for $language');
return Paths.font('vcr');
}

public static function getCustomFont():String {
Expand Down
2 changes: 1 addition & 1 deletion source/backend/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Paths {
return file('songs/$key/chart.json');

inline static public function font(key:String) {
var path:String = file('fonts/$key');
var path:String = file('fonts/$key');

if (path.extension() == '') {
if (exists(path.withExtension("ttf")))
Expand Down
2 changes: 1 addition & 1 deletion source/options/LanguageState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class LanguageState extends ExtendableState {
var langStrings:Array<Locale> = [];
var group:FlxTypedGroup<FlxText>;
var curSelected:Int = 0;

var camFollow:FlxObject;

override function create() {
Expand Down Expand Up @@ -80,7 +81,6 @@ class LanguageState extends ExtendableState {
if (Input.justPressed('accept')) {
SaveData.settings.lang = langStrings[curSelected].code;
Localization.switchLanguage(SaveData.settings.lang);
Localization.loadCustomFont(SaveData.settings.lang);
SaveData.saveSettings();
ExtendableState.switchState(new OptionsState());
FlxG.sound.play(Paths.sound("select"));
Expand Down

0 comments on commit a30b399

Please sign in to comment.