diff --git a/index.html b/index.html
index d895d34ad..5090192a4 100644
--- a/index.html
+++ b/index.html
@@ -19,10 +19,6 @@
font-family: 'emerald';
src: url('./fonts/pokemon-emerald-pro.ttf') format('truetype');
}
- @font-face {
- font-family: 'dppt';
- src: url('./fonts/pokemon-dppt.ttf') format('truetype');
- }
@font-face {
font-family: 'pkmnems';
diff --git a/src/loading-scene.ts b/src/loading-scene.ts
index 5f298b994..a49fed480 100644
--- a/src/loading-scene.ts
+++ b/src/loading-scene.ts
@@ -307,7 +307,7 @@ export class LoadingScene extends SceneBase {
y: height / 2 - 24,
text: '0%',
style: {
- font: "72px emerald, dppt",
+ font: "72px emerald",
color: "#ffffff",
},
});
@@ -318,7 +318,7 @@ export class LoadingScene extends SceneBase {
y: height / 2 + 48,
text: "",
style: {
- font: "48px emerald, dppt",
+ font: "48px emerald",
color: "#ffffff",
},
});
diff --git a/src/main.ts b/src/main.ts
index 948e59cb9..b3b4d5f3c 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -91,7 +91,7 @@ Phaser.GameObjects.Text.prototype.setPositionRelative = setPositionRelative;
BBCodeText.prototype.setPositionRelative = setPositionRelative;
Phaser.GameObjects.Rectangle.prototype.setPositionRelative = setPositionRelative;
-document.fonts.load('16px emerald, dppt').then(() => document.fonts.load('10px pkmnems'));
+document.fonts.load('16px emerald').then(() => document.fonts.load('10px pkmnems'));
let game;
diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts
index aae50ef30..785b66c0c 100644
--- a/src/plugins/i18n.ts
+++ b/src/plugins/i18n.ts
@@ -36,12 +36,36 @@ export interface Localizable {
localize(): void;
}
+const alternativeFonts = {
+ 'ko': [
+ new FontFace("emerald", "url(./fonts/pokemon-dppt.ttf)")
+ ],
+}
+
+function loadFont(language: string) {
+ Object.keys(alternativeFonts).forEach(l => {
+ if (language == l) {
+ alternativeFonts[l].forEach(f=> { document.fonts.add(f); });
+ }
+ else {
+ alternativeFonts[l].forEach(f=> {
+ if (f && f.status == "loaded") { document.fonts.delete(f); }
+ });
+ }
+ });
+}
+
export function initI18n(): void {
let lang = '';
if (localStorage.getItem('prLang'))
lang = localStorage.getItem('prLang');
+ loadFont(lang);
+ i18next.on("languageChanged", lng=> {
+ loadFont(lng);
+ });
+
/**
* i18next is a localization library for maintaining and using translation resources.
*
diff --git a/src/ui/message-ui-handler.ts b/src/ui/message-ui-handler.ts
index d6645a41b..44b3cc1a1 100644
--- a/src/ui/message-ui-handler.ts
+++ b/src/ui/message-ui-handler.ts
@@ -144,7 +144,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
const wrappedTextLines = this.message.runWordWrap(this.message.text).split(/\n/g);
const textLinesCount = wrappedTextLines.length;
const lastTextLine = wrappedTextLines[wrappedTextLines.length - 1];
- const lastLineTest = this.scene.add.text(0, 0, lastTextLine, { font: '96px emerald, dppt' });
+ const lastLineTest = this.scene.add.text(0, 0, lastTextLine, { font: '96px emerald' });
lastLineTest.setScale(this.message.scale);
const lastLineWidth = lastLineTest.displayWidth;
lastLineTest.destroy();
diff --git a/src/ui/text.ts b/src/ui/text.ts
index aa17128ef..d7ecd3b25 100644
--- a/src/ui/text.ts
+++ b/src/ui/text.ts
@@ -68,7 +68,7 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio
let shadowSize = 6;
let styleOptions: Phaser.Types.GameObjects.Text.TextStyle = {
- fontFamily: 'emerald, dppt',
+ fontFamily: 'emerald',
fontSize: '96px',
color: getTextColor(style, false, uiTheme),
padding: {