more specific font unicode ranges and add unifont to existing families (#2459)
This commit is contained in:
parent
f016e2dbca
commit
e2a9f76926
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in New Issue