3
3
4
4
5
5
This directory contains font maps of various fonts, as well
6
- as a tool to interpret them ( ` scripts/create_custom_font.js ` )
6
+ as tools to interpret them
7
7
8
- Currently this is only used for testing purposes.
8
+ ## Tools
9
+
10
+ These are now (mainly) stored in https://github.com/espruino/EspruinoWebTools
11
+
12
+ ## 4x6 and 6x8
13
+
14
+ These are fixed-width fonts, created from:
15
+
16
+ * font4x6.png
17
+ * font6x8.png
18
+
19
+ ```
20
+ node ~/workspace/EspruinoWebTools/cli/fontconverter.js font4x6.png --height 6 --debug --oh bitmap_font_4x6.h
21
+ node ~/workspace/EspruinoWebTools/cli/fontconverter.js font6x8.png --height 8 --debug --oh bitmap_font_6x8.h
22
+ ```
23
+
24
+ This doesn't generate the exact file, as the code to decode it (` graphicsDrawChar4x6 ` /etc) is usually on the end.
25
+
26
+ ## Vector Fonts
27
+
28
+ The vector font is stored in ` fontmap_13x19.svg ` and is decoded with ` build_vector_font.js `
29
+
30
+ ## renaissance Fonts
31
+
32
+ These fonts are used by Bangle.js 2. These are turned into Espruino files (embedded ` pbf ` fonts) with the following commands:
33
+
34
+ ```
35
+ node ~/workspace/EspruinoWebTools/cli/fontconverter.js renaissance_28.pbff --range All --height 22 --shiftUp 10 --nudge --debug --spaceWidth 4 --opbfc 22
36
+ node ~/workspace/EspruinoWebTools/cli/fontconverter.js renaissance_24_bold.pbff --range All --height 19 --shiftUp 8 --nudge --debug --spaceWidth 3 --opbfc 19
37
+ node ~/workspace/EspruinoWebTools/cli/fontconverter.js renaissance_18_bold.pbff --range All --height 15 --shiftUp 7 --nudge --debug --spaceWidth 3 --opbfc 15
38
+ node ~/workspace/EspruinoWebTools/cli/fontconverter.js renaissance_18_doubled.pbff --range All --height 30 --spaceWidth 6 --opbfc 30
39
+ ```
40
+
41
+ ` renaissance_18_doubled.pbff ` was originally created with:
42
+
43
+ ```
44
+ node ~/workspace/EspruinoWebTools/cli/fontconverter.js renaissance_18.pbff --range All --height 15 --shiftUp 7 --nudge --doubleSize --opbff renaissance_18_doubled.pbff
45
+ ```
46
+
47
+ And then patched up by hand to attempt to smooth it out. Some glyphs are still not complete.
48
+
49
+ ## Testing
9
50
10
51
You can dump a font map from Espruino using something like this:
11
52
@@ -14,8 +55,8 @@ var W=4,H=6,FONT="4x6";
14
55
//var W=6,H=8,FONT="6x8";
15
56
var b = Graphics.createArrayBuffer(W*16,H*16,1,{msb:true});
16
57
b.clear(1).setFont(FONT);
17
- for (var y=0;y<16;y++) {
18
- for (var x=0;x<16;x++) {
58
+ for (var y=0;y<16;y++) {
59
+ for (var x=0;x<16;x++) {
19
60
if (x || y) b.drawString(String.fromCharCode(x+(y*16)),x*W,y*H)
20
61
}
21
62
}
0 commit comments