update zh font to unicode to fit both

This commit is contained in:
Matthew Olker 2024-06-10 23:21:19 -04:00
parent 073c8aaf01
commit 8c596c6f33
6 changed files with 13 additions and 6 deletions

View File

@ -20,9 +20,9 @@
src: url('./fonts/pokemon-emerald-pro.ttf') format('truetype');
}
@font-face {
font-family: 'vonwaon';
src: url('./fonts/VonwaonBitmap-16px.ttf') format('truetype');
size-adjust: 66.7%;
font-family: 'unifont';
src: url('./fonts/unifont-15.1.05.otf') format('opentype');
size-adjust: 70%;
}
@font-face {

Binary file not shown.

Binary file not shown.

View File

@ -150,7 +150,7 @@ 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("16px vonwaon");
document.fonts.load("12px unifont");
let game;

View File

@ -89,8 +89,8 @@ export interface Localizable {
}
const fonts = [
new FontFace("emerald", "url(./fonts/pokemon-emerald-pro.ttf"),
new FontFace("emerald", "url(./fonts/PokePT_Wansung.ttf)"),
new FontFace("emerald", "url(./fonts/pokemon-emerald-pro.ttf"),
];
function initFonts() {

View File

@ -5,6 +5,7 @@ import { EggTier } from "../data/enums/egg-type";
import { UiTheme } from "../enums/ui-theme";
import { ModifierTier } from "../modifier/modifier-tier";
import Phaser from "phaser";
import i18next from "i18next";
export enum TextStyle {
MESSAGE,
@ -83,13 +84,14 @@ export function addTextInputObject(scene: Phaser.Scene, x: number, y: number, wi
}
function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle): [ number, Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig, string, number, number ] {
const {resolvedLanguage} = i18next;
let shadowXpos = 4;
let shadowYpos = 5;
const scale = 0.1666666667;
const defaultFontSize = 96;
let styleOptions: Phaser.Types.GameObjects.Text.TextStyle = {
fontFamily: "emerald, vonwaon",
fontFamily: "emerald, unifont",
fontSize: 96,
color: getTextColor(style, false, uiTheme),
padding: {
@ -142,6 +144,11 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio
break;
}
if (["zh"].includes(resolvedLanguage.substring(0,2))) {
shadowXpos = 0;
shadowYpos = 0;
}
const shadowColor = getTextColor(style, true, uiTheme);
if (extraStyleOptions) {