Added font for NTSC-U

This commit is contained in:
sup39 2023-05-17 22:28:41 +09:00
parent 6a9302028d
commit c22ffabc73
No known key found for this signature in database
GPG key ID: 14D2E0D21140D260
10 changed files with 1400 additions and 36 deletions

View file

@ -1,4 +1,8 @@
# Changelog
## May 17, 2023
- Added font for NTSC-U
- Fixed the encoding of NTSC-U and PAL (should be Windows-1252 instead of latin1)
## Feb 28, 2023
Fix preview of Controller Input Display

View file

@ -21,8 +21,7 @@ export default {
},
computed: {
previewCssClass() {
// TODO US
return `preview-str preview-${['GMSJ01', 'GMSJ0A'].includes(this.version) ? 'JP' : 'EU'}`;
return `preview-str preview-${this.version.startsWith('GMSJ') ? 'JP' : this.version === 'GMSE01' ? 'US' : 'EU'}`;
},
styles() {
const {config, version} = this;
@ -96,6 +95,13 @@ export default {
mask-image: url(/img/preview/font-JP.png);
-webkit-mask-image: url(/img/preview/font-JP.png);
}
.preview-US .char-bg {
background: url(/img/preview/font-US.png);
}
.preview-US .char-mask {
mask-image: url(/img/preview/font-US.png);
-webkit-mask-image: url(/img/preview/font-US.png);
}
.preview-EU .char-bg {
background: url(/img/preview/font-EU.png);
}

View file

@ -1,5 +1,6 @@
import charInfoJP from '../../data/charInfo-JP.json';
import charInfoEU from '../../data/charInfo-EU.json';
import charInfoUS from '../../data/charInfo-US.json';
/**
* @typedef {number} Inst
@ -198,7 +199,11 @@ export function liDX(rT, D) {
*/
export function str2bytes(s, version) {
/** @type {Record<string, (typeof charInfoJP)[' ']>} */
const charInfo = version.startsWith('GMSJ') ? charInfoJP : charInfoEU; // TODO US
const charInfo = version.startsWith('GMSJ')
? charInfoJP
: version === 'GMSE01'
? charInfoUS
: charInfoEU;
const fmtbuf = Array.from(s).flatMap((c) => {
const code = charInfo[c]?.code ?? c.charCodeAt(0); // TODO multi-byte invalid char
return code >= 0x100 ? [code >> 8, code & 0xff] : [code];

View file

@ -1,20 +1,23 @@
/** @typedef {{index: number, kerning: number, width: number, code: number}} CharInfo */
import charInfoJP from '../../data/charInfo-JP.json';
import charInfoEU from '../../data/charInfo-EU.json';
import charInfoUS from '../../data/charInfo-US.json';
/**
* @param {string} version
*/
const getFontInfo = (version) =>
['GMSJ01', 'GMSJ0A'].includes(version)
version.startsWith('GMSJ')
? {
// JP
charInfo: /**@type{Record<string, CharInfo>}*/ (charInfoJP),
rowSize: 24, // how many char in a row of the img
}
: {
// EU (TODO US)
charInfo: /**@type{Record<string, CharInfo>}*/ (charInfoEU),
// US, EU
charInfo: /**@type{Record<string, CharInfo>}*/ (
version === 'GMSE01' ? charInfoUS : charInfoEU
),
rowSize: 16, // how many char in a row of the img
};

View file

@ -575,7 +575,7 @@
"width": 20,
"code": 127
},
"\u0080": {
"\u20ac": {
"index": 96,
"kerning": 1,
"width": 16,
@ -587,67 +587,67 @@
"width": 20,
"code": 129
},
"\u0082": {
"\u201a": {
"index": 98,
"kerning": 0,
"width": 8,
"code": 130
},
"\u0083": {
"\u0192": {
"index": 99,
"kerning": 2,
"width": 13,
"code": 131
},
"\u0084": {
"\u201e": {
"index": 100,
"kerning": 0,
"width": 12,
"code": 132
},
"\u0085": {
"\u2026": {
"index": 101,
"kerning": 1,
"width": 17,
"code": 133
},
"\u0086": {
"\u2020": {
"index": 102,
"kerning": 0,
"width": 20,
"code": 134
},
"\u0087": {
"\u2021": {
"index": 103,
"kerning": 0,
"width": 20,
"code": 135
},
"\u0088": {
"\u02c6": {
"index": 104,
"kerning": 3,
"width": 9,
"code": 136
},
"\u0089": {
"\u2030": {
"index": 105,
"kerning": 0,
"width": 20,
"code": 137
},
"\u008a": {
"\u0160": {
"index": 106,
"kerning": 2,
"width": 14,
"code": 138
},
"\u008b": {
"\u2039": {
"index": 107,
"kerning": 3,
"width": 14,
"code": 139
},
"\u008c": {
"\u0152": {
"index": 108,
"kerning": 0,
"width": 19,
@ -659,7 +659,7 @@
"width": 20,
"code": 141
},
"\u008e": {
"\u017d": {
"index": 110,
"kerning": 2,
"width": 14,
@ -677,73 +677,73 @@
"width": 20,
"code": 144
},
"\u0091": {
"\u2018": {
"index": 113,
"kerning": 4,
"width": 5,
"code": 145
},
"\u0092": {
"\u2019": {
"index": 114,
"kerning": 4,
"width": 5,
"code": 146
},
"\u0093": {
"\u201c": {
"index": 115,
"kerning": 3,
"width": 8,
"code": 147
},
"\u0094": {
"\u201d": {
"index": 116,
"kerning": 3,
"width": 8,
"code": 148
},
"\u0095": {
"\u2022": {
"index": 117,
"kerning": 1,
"width": 15,
"code": 149
},
"\u0096": {
"\u2013": {
"index": 118,
"kerning": 0,
"width": 20,
"code": 150
},
"\u0097": {
"\u2014": {
"index": 119,
"kerning": 0,
"width": 20,
"code": 151
},
"\u0098": {
"\u02dc": {
"index": 120,
"kerning": 2,
"width": 13,
"code": 152
},
"\u0099": {
"\u2122": {
"index": 121,
"kerning": 2,
"width": 16,
"code": 153
},
"\u009a": {
"\u0161": {
"index": 122,
"kerning": 2,
"width": 13,
"code": 154
},
"\u009b": {
"\u203a": {
"index": 123,
"kerning": 0,
"width": 15,
"code": 155
},
"\u009c": {
"\u0153": {
"index": 124,
"kerning": 0,
"width": 19,
@ -755,13 +755,13 @@
"width": 20,
"code": 157
},
"\u009e": {
"\u017e": {
"index": 126,
"kerning": 2,
"width": 12,
"code": 158
},
"\u009f": {
"\u0178": {
"index": 127,
"kerning": 1,
"width": 15,

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB