Moar characters

This commit is contained in:
Korneliusz Osmenda
2022-08-22 21:59:26 +02:00
parent 0a8ff0ca65
commit ea35e1407e
2 changed files with 270 additions and 11 deletions
+19 -2
View File
@@ -5,7 +5,21 @@ from PIL import Image, ImageOps
from pathlib import Path
import bdflib.reader
used_chars = "?bac"
used_set=set()
def add_string(s,str):
for c in str:
s.add(c)
add_string(used_set,"1234567890")
add_string(used_set,"Bat")
add_string(used_set,"PV")
add_string(used_set,"Out")
add_string(used_set,"VA%+- ")
add_string(used_set,"/-\\|")
if "?" in used_set:
used_set.remove("?")
used_chars = "?"+"".join(sorted(used_set))
bdf_file = Path(sys.argv[1])
bdf=bdflib.reader.read_bdf(open(bdf_file,'rb'))
@@ -47,7 +61,10 @@ def gen_char(tgt,ch):
def gen_map_hdr(tgt):
tgt.write('char my_font_map_[]')
def gen_map_char(tgt,char):
tgt.write(" '%s',\n"%char)
if char == "\\":
tgt.write(" '\\\\',\n")
else:
tgt.write(" '%s',\n"%char)
source.write("/*autogenerated file*/\n")
+251 -9
View File
@@ -12,15 +12,215 @@ unsigned char my_font_[][16] =
0xff,0xff,
},
{
0xdf,0xc0,
0xc0,0xfb,
0xf9,0xfc,
0xff,0xff,
0xff,0xff,
0xff,0xff,
0xff,0xff,
0xff,0xff,
0xff,0xff,
0xff,0xff,
0xff,0xff,
},
{
0xf3,0xf3,
0xff,0xfe,
0xfc,0xf9,
0xf3,0xff,
0xcf,0x9f,
0x3f,0x7f,
0xff,0xcf,
0xcf,0xff,
},
{
0xff,0xfe,
0xfe,0xf8,
0xf8,0xfe,
0xfe,0xff,
0xff,0xff,
0xff,0x3f,
0x3f,0xff,
0xff,0xff,
},
{
0xfe,0xfe,
0xfe,0xfe,
0xfe,0xfe,
0xfe,0xff,
0xff,0xff,
0xff,0xff,
0xff,0xff,
0xff,0xff,
},
{
0xff,0xff,
0xff,0xfe,
0xfc,0xf9,
0xf3,0xff,
0xcf,0x9f,
0x3f,0x7f,
0xff,0xff,
0xff,0xff,
},
{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xff,
},
{
0xe0,0xc0,
0xdf,0xdf,
0xdf,0xc0,
0xe0,0xff,
0x1f,0x0f,
0xef,0xef,
0xef,0x0f,
0x1f,0xff,
},
{
0xdf,0xc0,
0xc0,0xdd,
0xdd,0xc1,
0xe3,0xff,
0xef,0x0f,
0x0f,0xef,
0xff,0xff,
0xff,0xff,
},
{
0xc0,0xc0,
0xff,0xff,
0xff,0xc0,
0xc0,0xff,
0x7f,0x3f,
0x9f,0xcf,
0x9f,0x3f,
0x7f,0xff,
},
{
0xe3,0xf1,
0xf8,0xfc,
0xfe,0xff,
0xff,0xff,
0xff,0xff,
0xff,0x7f,
0x3f,0x1f,
0x8f,0xff,
},
{
0xff,0xfa,
0xfa,0xfa,
@@ -32,21 +232,63 @@ unsigned char my_font_[][16] =
0xef,0xff,
},
{
0xfc,0xf8,
0xfb,0xfb,
0xfb,0xf9,
0xfd,0xff,
0xe0,0xc0,
0xfb,0xfb,
0xff,0xff,
0xff,0xff,
0x1f,0x0f,
0xef,0xef,
0xef,0xcf,
0xdf,0xff,
},
{
0xf8,0xf8,
0xff,0xff,
0xf8,0xf8,
0xff,0xff,
0x1f,0x0f,
0xef,0xef,
0x1f,0x0f,
0xef,0xff,
},
{
0xff,0xff,
0xff,0xc2,
0xc2,0xff,
0xff,0xff,
0xff,0xff,
0xff,0x0f,
0x0f,0xff,
0xff,0xff,
},
};
char my_font_map_[]=
{
'?',
'b',
' ',
'%',
'+',
'-',
'/',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'O',
'P',
'V',
'\\',
'a',
'c',
't',
'u',
'|',
'\0',
};