diff --git a/index.html b/index.html index a86f7832fc7..3722bdd3422 100644 --- a/index.html +++ b/index.html @@ -31,11 +31,6 @@ font-family: 'emerald'; src: url('./fonts/pokemon-emerald-pro.ttf') format('truetype'); } - @font-face { - font-family: 'unifont'; - src: url('./fonts/unifont-15.1.05.otf') format('opentype'); - size-adjust: 70%; - } @font-face { font-family: 'pkmnems'; diff --git a/src/main.ts b/src/main.ts index e750335ddd4..41cd68afc1e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -150,7 +150,6 @@ Phaser.GameObjects.Text.prototype.setPositionRelative = setPositionRelative; Phaser.GameObjects.Rectangle.prototype.setPositionRelative = setPositionRelative; document.fonts.load("16px emerald").then(() => document.fonts.load("10px pkmnems")); -document.fonts.load("12px unifont"); let game; diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 14e5c74f12c..ed2b0c8dc56 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -12,12 +12,45 @@ import { ptBrConfig } from "#app/locales/pt_BR/config.js"; import { zhCnConfig } from "#app/locales/zh_CN/config.js"; import { zhTwConfig } from "#app/locales/zh_TW/config.js"; +const unicodeHalfAndFullWidthForms = [ + "U+FF00-FFEF" +]; + +const unicodeCJK = [ + "U+2E80-2EFF", + "U+3000-303F", + "U+31C0-31EF", + "U+3200-32FF", + "U+3400-4DBF", + "U+4E00-9FFF", + "U+F900-FAFF", + "U+FE30-FE4F", +].join(","); + +const unicodeHangul = [ + "U+1100-11FF", + "U+3130-318F", + "U+A960-A97F", + "U+AC00-D7AF", + "U+D7B0-D7FF", +].join(","); + const fonts = [ - new FontFace("emerald", "url(./fonts/PokePT_Wansung.ttf)", { unicodeRange: "U+AC00-D7AC"}), + // korean + new FontFace("emerald", "url(./fonts/PokePT_Wansung.ttf)", { unicodeRange: unicodeHangul}), Object.assign( - new FontFace("pkmnems", "url(./fonts/PokePT_Wansung.ttf)", { unicodeRange: "U+AC00-D7AC"}), + new FontFace("pkmnems", "url(./fonts/PokePT_Wansung.ttf)", { unicodeRange: unicodeHangul}), { sizeAdjust: "133%" } ), + // unicode + Object.assign( + new FontFace("emerald", "url(./fonts/unifont-15.1.05.otf)", { unicodeRange: [unicodeCJK, unicodeHalfAndFullWidthForms].join(",") }), + { sizeAdjust: "70%", format: "opentype" } + ), + Object.assign( + new FontFace("pkmnems", "url(./fonts/unifont-15.1.05.otf)", { unicodeRange: [unicodeCJK, unicodeHalfAndFullWidthForms].join(",") }), + { sizeAdjust: "70%", format: "opentype" } + ), ]; async function initFonts() { diff --git a/src/ui/text.ts b/src/ui/text.ts index b74742fef74..046abce2d87 100644 --- a/src/ui/text.ts +++ b/src/ui/text.ts @@ -89,7 +89,7 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio const defaultFontSize = 96; let styleOptions: Phaser.Types.GameObjects.Text.TextStyle = { - fontFamily: "emerald, unifont", + fontFamily: "emerald", fontSize: 96, color: getTextColor(style, false, uiTheme), padding: {