forked from deividAlfa/stm32_soldering_iron_controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notes.txt
59 lines (43 loc) · 2.81 KB
/
Notes.txt
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
49
50
51
52
53
54
55
56
57
58
59
When the bdf font is generated, the current approach for adding cyrillic characters is patching them.
The font files are:
- font_menu: bdf/font_menu.bdf (Modded from t0-16-uni.bdf)
Uses cyrillic chars 1040-1103, turkish 286,287,350,351 from unifont.bdf
Ohm symbol 937 custom made.
- font_small: bdf/font_small.bdf (Modded from bdf/Wizzard12.bdf)
Uses cyrillic chars 1040-1103, turkish 199,231,286,287,350,351 from 6x13.bdf
- font_iron_temp: bdf/ITC Avant Garde Gothic Medium_31.bdf
Only displays 0-9, C, F and ° (ASCII 176), no special characters.
To modify and insert data from a different bdf font:
Open the both BDFs with a text editor.
The number of fonts are defined in this line
CHARS 64
Each character uses this structure
STARTCHAR 0411 -> Start character block. The name can be anything (ex. STARTCHAR A_Letter)
ENCODING 1041 -> Actual unicode in decimal (1041 = 0x411)
SWIDTH 675 0
DWIDTH 15 0
BBX 12 16 2 0
BITMAP -> Start of bitmap data
--- -> Bitmap data
---
ENDCHAR -> End of character block
To add a character from one font to another, just copy the STARTCHAR--->ENDCHAR blocks and paste them in the destination font.
Take care to not duplicate them, always search the ENCODING number and replace the whole block.
If it doesn't exists, the CHARS count must be increased.
Now the font will have the new symbol, and be ready for conversion using bdfconv.
Run make_font_menu.bat and make_font_small.bat to generate the new fonts, they will appear in "out" folder.
U8g2 font structure mix octal and char representation to be as compact as possible.
So when a characters starts with escape(\) the next 1,2,3 numbers will be the octal representation, a single byte.
But you might also find any other symbol, like spaces, letters, these are a signle character.
The default fonts report too much height and need to be patched manually:
For u8g2_font_menu, replace the 10th byte, in this case \21, with \17
Original: "\257\0\3\2\4\4\4\4\5\10\21\0\375\12\375\13\377\1\207\3\42\5' \5\0\210\30!\7\241\214"
Modified: "\257\0\3\2\4\4\4\4\5\10\17\0\375\12\375\13\377\1\207\3\42\5' \5\0\210\30!\7\241\214"
^
For u8g2_font_small, replace the 10th byte, in this case \17, with \12.
Original: "\257\0\3\2\4\4\2\4\5\11\17\0\375\10\376\10\376\1T\2\274\4k \5\0b\5!\6\201\343"
Modified: "\257\0\3\2\4\4\2\4\5\11\12\0\375\10\376\10\376\1T\2\274\4k \5\0b\5!\6\201\343"
^
Copy the contents of the generated files (not the files), and replace the existing sections at the beginning of Drivers/graphics/gui/u8g2/u8g2_fonts.c
Then, open Drivers/graphics/gui/u8g2/u8g2.h and update the font size with the new values (ex. const uint8_t u8g2_font_small[2073])
After that, the font modification will be done.