-
Notifications
You must be signed in to change notification settings - Fork 0
/
compileFont.js
48 lines (44 loc) · 1.02 KB
/
compileFont.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const fs = require('fs');
const fontData = fs.readFileSync('../fontdata.txt', 'utf8').split('\n');
const specialFontData = fs.readFileSync('../specialfontdata.txt', 'utf8').split('\n');
const SPECIAL_CHAR_IDENTIFIERS = [
'BTN_UP',
'BTN_LEFT',
'BTN_RIGHT',
'BTN_DOWN',
'BTN_TRIANGLE',
'BTN_SQUARE',
'BTN_CIRCLE',
'BTN_CROSS',
'PT_WALL',
'PT_ELECTRONICS',
'PT_POWERED',
'PT_SENSORS',
'PT_FORCE',
'PT_EXPLOSIVES',
'PT_GASSES',
'PT_LIQUID',
'PT_POWDER',
'PT_SOLIDS',
'PT_RADIOACTIVE',
'PT_SPECIAL',
'PT_LIFE',
'PT_TOOLS',
'PT_FAVOURITES',
'PT_DECORATION',
'PT_SEARCH',
'PT_STICKMAN'
];
const chars = {}, specialChars = {};
for(let i = 0; i < 95; i++){
chars[String.fromCharCode(i + 32)] = fontData[i];
}
for(let i = 0; i < SPECIAL_CHAR_IDENTIFIERS.length; i++){
chars[SPECIAL_CHAR_IDENTIFIERS[i]] = specialFontData[i];
specialChars[SPECIAL_CHAR_IDENTIFIERS[i]] = specialFontData[i];
}
const charDict = {
chars: chars,
specialChars: specialChars
};
fs.writeFileSync('utils/charDict.json', JSON.stringify(charDict));