修改示例代码和工具.

Signed-off-by: lion.chan <cy187lion@sina.com>
This commit is contained in:
lion.chan 2023-04-28 08:43:16 +08:00
parent 64647e94f0
commit 02a5fc1380
3 changed files with 337 additions and 0 deletions

View File

@ -0,0 +1,252 @@
'''
01Studio 中文字符
点阵字库由 PCtoLCD200 生成阴码逐行顺向取模十六进制输出C51格式先后缀均为,
'''
'''
size = 1
16 x 16 汉字字库
宋体阴码逐行式顺向高位在前
'''
hanzi_16x16_dict = {
'' : (0x3F,0xF8,0x01,0x00,0x7F,0xFE,0x41,0x02,0x9D,0x74,0x01,0x00,0x1D,0x70,0x02,0x80,
0x0C,0x60,0x32,0x18,0xC1,0x06,0x1F,0xE0,0x00,0x20,0x06,0x40,0x01,0x80,0x00,0x40),
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
"" : (0x08,0x10,0x1D,0x10,0xF0,0x90,0x10,0x90,0x10,0x10,0xFD,0x10,0x10,0x90,0x38,0x90,
0x34,0x10,0x50,0x1E,0x53,0xF0,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10),
"" : (0x10,0x20,0x10,0x20,0x10,0x20,0x13,0xFE,0xFC,0x20,0x10,0x20,0x10,0x20,0x15,0xFC,
0x18,0x84,0x30,0x88,0xD0,0x48,0x10,0x50,0x10,0x20,0x10,0x50,0x51,0x88,0x26,0x06),
}
'''
size = 2
24 x 24 汉字字库
宋体阴码逐行式顺向高位在前
'''
hanzi_24x24_dict = {
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x07,0xFF,0xE0,0x00,0x18,0x00,0x1F,
0xFF,0xFC,0x10,0x18,0x0C,0x37,0x9B,0xE8,0x30,0x18,0x10,0x00,0x10,0x00,0x07,0x9B,
0xE0,0x00,0x38,0x00,0x00,0xC4,0x00,0x01,0x83,0x00,0x06,0x18,0xFE,0x38,0x08,0x1C,
0x07,0xFF,0x80,0x00,0x01,0x80,0x00,0x06,0x00,0x00,0xE8,0x00,0x00,0x1C,0x00,0x00,
0x06,0x00,0x00,0x03,0x00,0x00,0x00,0x00,),
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x7F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,),
'' : (0x00,0x00,0x00,0x00,0x00,0x20,0x00,0xE0,0x30,0x1F,0x00,0x20,0x03,0x00,0x20,0x03,
0x06,0x20,0x03,0x03,0x20,0x03,0x00,0x20,0x7F,0xE0,0x20,0x03,0x00,0x20,0x03,0x04,
0x20,0x07,0x06,0x20,0x07,0xC2,0x20,0x0F,0x62,0x24,0x0B,0x22,0x2E,0x13,0x01,0xF0,
0x13,0x1E,0x20,0x23,0x20,0x20,0x43,0x00,0x20,0x03,0x00,0x20,0x03,0x00,0x20,0x03,
0x00,0x20,0x03,0x00,0x20,0x02,0x00,0x20,),
'' : (0x00,0x00,0x00,0x04,0x01,0x00,0x06,0x01,0x80,0x06,0x01,0x00,0x06,0x01,0x00,0x06,
0x01,0x00,0x7F,0xFF,0xFC,0x06,0x01,0x00,0x06,0x01,0x00,0x06,0x01,0x00,0x06,0x41,
0x00,0x07,0xBF,0xF8,0x0E,0x08,0x10,0x76,0x08,0x30,0x26,0x04,0x20,0x06,0x04,0x60,
0x06,0x02,0x40,0x06,0x02,0xC0,0x06,0x01,0x80,0x06,0x02,0xC0,0x26,0x0C,0x70,0x1E,
0x30,0x3E,0x04,0xC0,0x08,0x00,0x00,0x00,),
}
'''
size = 3
32 x 32 汉字字库
宋体阴码逐行式顺向高位在前
'''
hanzi_32x32_dict = {
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0xFF,0xFF,0xC0,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x07,0xFF,0xFF,0xF8,0x0C,0x01,0x80,0x18,
0x0C,0x01,0x80,0x30,0x18,0x01,0x80,0x20,0x19,0xF9,0x9F,0x80,0x00,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xF9,0x1F,0x80,0x00,0x03,0x80,0x00,0x00,0x07,0x80,0x00,
0x00,0x0C,0x40,0x00,0x00,0x3C,0x30,0x00,0x00,0x73,0x1C,0x00,0x01,0xC1,0x87,0xF0,
0x0E,0x00,0x80,0xFC,0x30,0x00,0x80,0x10,0x03,0xFF,0xFE,0x00,0x00,0x00,0x0F,0x00,
0x00,0x00,0x18,0x00,0x00,0x20,0x60,0x00,0x00,0x1E,0x80,0x00,0x00,0x03,0xC0,0x00,
0x00,0x00,0xF0,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00),
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
"" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x0C,0x00,0xE0,
0x00,0x3C,0x00,0xC0,0x07,0xE0,0x00,0xC0,0x38,0xC0,0x00,0xC0,0x00,0xC0,0x60,0xC0,
0x00,0xC0,0x30,0xC0,0x00,0xC0,0x18,0xC0,0x00,0xC0,0x18,0xC0,0x00,0xC4,0x00,0xC0,
0x3F,0xFE,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x40,0xC0,0x01,0xC0,0x60,0xC0,
0x01,0xF0,0x30,0xC0,0x03,0xDC,0x10,0xC0,0x02,0xCC,0x00,0xCC,0x06,0xC4,0x00,0xFC,
0x04,0xC4,0x0F,0xC0,0x08,0xC1,0xF0,0xC0,0x10,0xC6,0x00,0xC0,0x20,0xC0,0x00,0xC0,
0x40,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,
0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0x80,0x00,0x80,0x00,0x00,0x00,0x00),
"" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x01,0xC0,0x0E,0x00,
0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,
0x01,0x98,0x0C,0x18,0x3F,0xFF,0xFF,0xFC,0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,
0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,0x01,0x8C,0x0C,0x20,0x01,0xB3,0xFF,0xF0,
0x01,0xC0,0x80,0x60,0x0F,0x80,0x80,0x60,0x3D,0x80,0x40,0xC0,0x31,0x80,0x40,0xC0,
0x01,0x80,0x61,0x80,0x01,0x80,0x21,0x80,0x01,0x80,0x33,0x00,0x01,0x80,0x16,0x00,
0x01,0x80,0x0E,0x00,0x01,0x80,0x1E,0x00,0x01,0x80,0x37,0x00,0x01,0x80,0xE3,0xC0,
0x1F,0x81,0x80,0xF8,0x07,0x8E,0x00,0x7C,0x02,0x30,0x00,0x00,0x00,0x00,0x00,0x00),
}
'''
size = 4
40 x 40 汉字字库
宋体阴码逐行式顺向高位在前
'''
hanzi_40x40_dict = {
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,
0x00,0x00,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x18,0x00,0x00,0x00,0x00,
0x18,0x00,0x00,0x02,0x00,0x18,0x00,0x30,0x03,0xFF,0xFF,0xFF,0xF8,0x06,0x00,0x18,
0x00,0x38,0x06,0x00,0x18,0x00,0x60,0x0E,0x00,0x18,0x00,0x40,0x1E,0xFF,0x18,0xFE,
0x80,0x08,0x00,0x18,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x10,0x00,0x00,
0x00,0xFF,0x38,0xFE,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0xE8,0x00,0x00,0x00,
0x01,0xC6,0x00,0x00,0x00,0x07,0x83,0x80,0x00,0x00,0x0E,0x40,0xE0,0x00,0x00,0x38,
0x30,0x3F,0x00,0x01,0xE0,0x1C,0x0F,0xFC,0x0F,0x00,0x0C,0x01,0xF0,0x30,0x00,0x08,
0x10,0x00,0x00,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0xE0,
0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x04,0x03,0x00,0x00,0x00,0x03,0x8C,0x00,0x00,
0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x0F,0x80,0x00,0x00,
0x00,0x03,0xC0,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,
0x00,0x00,0x00,0x00,0xF0,0x1F,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
"" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x01,0x80,0x03,0x80,0x00,
0x07,0xC0,0x03,0x00,0x00,0x3F,0xC0,0x03,0x00,0x07,0xF8,0x00,0x03,0x00,0x08,0x38,
0x00,0x03,0x00,0x00,0x38,0x06,0x03,0x00,0x00,0x38,0x03,0x83,0x00,0x00,0x38,0x01,
0xC3,0x00,0x00,0x38,0x00,0xC3,0x00,0x00,0x38,0x00,0xC3,0x00,0x00,0x38,0xC0,0x03,
0x00,0x3F,0xFF,0xE0,0x03,0x00,0x00,0x38,0x00,0x03,0x00,0x00,0x38,0x00,0x03,0x00,
0x00,0x78,0x06,0x03,0x00,0x00,0x78,0x03,0x03,0x00,0x00,0x7E,0x03,0x83,0x00,0x00,
0xFB,0x81,0x83,0x00,0x00,0xF9,0xC1,0x83,0x00,0x01,0xB9,0xC0,0x83,0x18,0x01,0xB8,
0xC0,0x03,0x3C,0x03,0x38,0xC0,0x03,0xF0,0x06,0x38,0x00,0x3F,0x00,0x04,0x38,0x07,
0xC3,0x00,0x08,0x38,0xF8,0x03,0x00,0x18,0x38,0x40,0x03,0x00,0x30,0x38,0x00,0x03,
0x00,0x00,0x38,0x00,0x03,0x00,0x00,0x38,0x00,0x03,0x00,0x00,0x38,0x00,0x03,0x00,
0x00,0x38,0x00,0x03,0x00,0x00,0x38,0x00,0x03,0x00,0x00,0x38,0x00,0x03,0x00,0x00,
0x38,0x00,0x03,0x00,0x00,0x38,0x00,0x03,0x00,0x00,0x20,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
"" : (0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x00,0x70,0x00,0x70,0x00,0x00,
0x70,0x00,0x70,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x60,
0x00,0x60,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x63,0x00,
0x60,0x30,0x3F,0xFF,0xFF,0xFF,0xF8,0x00,0x60,0x00,0x60,0x00,0x00,0x60,0x00,0x60,
0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x60,0x00,0x60,0x00,
0x00,0x60,0x80,0x60,0x00,0x00,0x63,0x00,0x60,0xC0,0x00,0x6C,0x3F,0xFF,0xE0,0x00,
0xF8,0x08,0x01,0xC0,0x03,0xE0,0x08,0x01,0x80,0x1F,0x60,0x04,0x01,0x80,0x3E,0x60,
0x04,0x03,0x80,0x18,0x60,0x06,0x03,0x00,0x00,0x60,0x02,0x07,0x00,0x00,0x60,0x03,
0x06,0x00,0x00,0x60,0x01,0x0E,0x00,0x00,0x60,0x01,0x9C,0x00,0x00,0x60,0x00,0xD8,
0x00,0x00,0x60,0x00,0xF0,0x00,0x00,0x60,0x00,0x70,0x00,0x00,0x60,0x01,0xF8,0x00,
0x00,0x60,0x03,0x9C,0x00,0x00,0x60,0x0F,0x0F,0x00,0x0F,0xE0,0x1C,0x07,0xE0,0x03,
0xE0,0x70,0x01,0xFC,0x01,0xC3,0x80,0x00,0x70,0x00,0x8C,0x00,0x00,0x10,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
}
'''
size = 5
48 x 48 汉字字库
宋体阴码逐行式顺向高位在前
'''
hanzi_48x48_dict = {
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3F,0xFF,0xFF,0xFE,0x00,0x00,0x00,
0x01,0x80,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x00,0x01,0x80,0x00,0x00,
0x01,0x00,0x01,0x80,0x00,0x60,0x01,0xFF,0xFF,0xFF,0xFF,0xF0,0x03,0x00,0x01,0x80,
0x00,0xF0,0x03,0x00,0x01,0x80,0x00,0xC0,0x07,0x00,0x01,0x80,0x00,0x80,0x07,0x00,
0x01,0x80,0x01,0x80,0x0F,0x3F,0xE1,0x8F,0xF9,0x00,0x04,0x00,0x01,0x80,0x00,0x00,
0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,
0x00,0x00,0x00,0x3F,0xE3,0x8F,0xFC,0x00,0x00,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,
0x0F,0x80,0x00,0x00,0x00,0x00,0x1E,0xC0,0x00,0x00,0x00,0x00,0x78,0x70,0x00,0x00,
0x00,0x00,0xF0,0x18,0x00,0x00,0x00,0x01,0xE0,0x0F,0x00,0x00,0x00,0x07,0x87,0x03,
0xE0,0x00,0x00,0x1E,0x03,0x81,0xFF,0x00,0x00,0x78,0x01,0xC0,0x3F,0xFC,0x03,0xC0,
0x01,0xC0,0x0F,0xF0,0x1E,0x00,0x00,0xC0,0x01,0xE0,0x20,0x00,0x00,0x80,0xC0,0x00,
0x00,0x3F,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0x00,0x07,
0xC0,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,
0x80,0x30,0x00,0x00,0x00,0x00,0x78,0xC0,0x00,0x00,0x00,0x00,0x1F,0x80,0x00,0x00,
0x00,0x00,0x07,0xF0,0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x7E,
0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,
0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
'' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x03,0xF0,0x1F,0xFF,
0xFF,0xFF,0xFF,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
"" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x00,0x00,0x00,0x10,0x00,0x0E,0x00,0x00,0x00,0x78,0x00,0x0F,0x00,0x00,0x01,
0xFC,0x00,0x0C,0x00,0x00,0x1F,0xF0,0x00,0x0C,0x00,0x01,0xFE,0x00,0x00,0x0C,0x00,
0x0E,0x06,0x00,0x00,0x0C,0x00,0x00,0x06,0x00,0x60,0x0C,0x00,0x00,0x06,0x00,0x38,
0x0C,0x00,0x00,0x06,0x00,0x1E,0x0C,0x00,0x00,0x06,0x00,0x0E,0x0C,0x00,0x00,0x06,
0x00,0x0E,0x0C,0x00,0x00,0x06,0x00,0x06,0x0C,0x00,0x00,0x06,0x08,0x00,0x0C,0x00,
0x00,0x06,0x1C,0x00,0x0C,0x00,0x1F,0xFF,0xFE,0x00,0x0C,0x00,0x00,0x0E,0x00,0x00,
0x0C,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x0E,0x00,0x60,0x0C,0x00,0x00,0x1E,
0x00,0x30,0x0C,0x00,0x00,0x1F,0x00,0x3C,0x0C,0x00,0x00,0x3E,0xC0,0x1C,0x0C,0x00,
0x00,0x36,0x70,0x0E,0x0C,0x00,0x00,0x76,0x78,0x0C,0x0C,0x20,0x00,0x66,0x38,0x0C,
0x0C,0x30,0x00,0xE6,0x1C,0x00,0x0C,0x78,0x00,0xC6,0x18,0x00,0x0D,0xF8,0x01,0x86,
0x08,0x00,0x3E,0x00,0x03,0x06,0x00,0x07,0xEC,0x00,0x07,0x06,0x01,0xF8,0x0C,0x00,
0x06,0x06,0x1F,0x00,0x0C,0x00,0x0C,0x06,0x00,0x00,0x0C,0x00,0x18,0x06,0x00,0x00,
0x0C,0x00,0x30,0x06,0x00,0x00,0x0C,0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,0x0E,
0x00,0x00,0x0C,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x0E,0x00,0x00,0x0C,0x00,
0x00,0x0E,0x00,0x00,0x0C,0x00,0x00,0x0E,0x00,0x00,0x0E,0x00,0x00,0x0E,0x00,0x00,
0x0E,0x00,0x00,0x0E,0x00,0x00,0x0E,0x00,0x00,0x0E,0x00,0x00,0x0E,0x00,0x00,0x08,
0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
"" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x02,
0x00,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1E,0x00,0x03,0xC0,0x00,0x00,0x1C,
0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,
0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,
0x80,0x00,0x00,0x1C,0x60,0x03,0x80,0x60,0x00,0x1C,0xF0,0x03,0x80,0xF0,0x1F,0xFF,
0xFF,0xFF,0xFF,0xF8,0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,
0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,
0x80,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,0x00,0x03,0x81,0x00,0x00,0x1C,
0x70,0x03,0x83,0x80,0x00,0x1D,0xC7,0xFF,0xFF,0xC0,0x00,0x1F,0x00,0x80,0x03,0x80,
0x00,0x7C,0x00,0xC0,0x07,0x00,0x03,0xFC,0x00,0x40,0x07,0x00,0x1F,0xDC,0x00,0x40,
0x06,0x00,0x1F,0x1C,0x00,0x60,0x0E,0x00,0x0C,0x1C,0x00,0x20,0x0E,0x00,0x08,0x1C,
0x00,0x30,0x1C,0x00,0x00,0x1C,0x00,0x30,0x1C,0x00,0x00,0x1C,0x00,0x18,0x38,0x00,
0x00,0x1C,0x00,0x18,0x70,0x00,0x00,0x1C,0x00,0x0C,0x70,0x00,0x00,0x1C,0x00,0x0E,
0xE0,0x00,0x00,0x1C,0x00,0x07,0xC0,0x00,0x00,0x1C,0x00,0x03,0x80,0x00,0x00,0x1C,
0x00,0x07,0xC0,0x00,0x00,0x1C,0x00,0x1F,0xE0,0x00,0x00,0x1C,0x00,0x3C,0xF8,0x00,
0x00,0x1C,0x00,0x70,0x7E,0x00,0x0F,0x3C,0x01,0xE0,0x1F,0x80,0x03,0xF8,0x07,0x80,
0x0F,0xFC,0x00,0xF8,0x1E,0x00,0x03,0xF8,0x00,0x70,0x70,0x00,0x00,0xE0,0x00,0x61,
0x80,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
}

View File

@ -0,0 +1,85 @@
'''
实验名称中文显示
版本v1.0
日期2022.3
作者01Studio
实验平台编程实现中文显示本例程使用1.54寸LCD不同LCD可自行修改
'''
#导入相关模块
from tftlcd import LCD15
import time,fonts,gc
#定义常用颜色
RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)
BLACK = (0,0,0)
WHITE = (255,255,255)
########################
# 构建1.5寸LCD对象并初始化
########################
d = LCD15(portrait=1) #默认方向竖屏
#填充白色
d.fill(BLACK)
#中文显示
def printChinese(text,x,y,color=(0,0,0),backcolor=(255,255,255),size=1):
font_size = [0,16,24,32,40,48] #分别对应size=1,2,3,4,5的字体尺寸0无效。
chinese_dict = {}
#获取对应的字模
if size==1:
chinese_dict = fonts.hanzi_16x16_dict
elif size==2:
chinese_dict = fonts.hanzi_24x24_dict
elif size==3:
chinese_dict = fonts.hanzi_32x32_dict
elif size==4:
chinese_dict = fonts.hanzi_40x40_dict
elif size==5:
chinese_dict = fonts.hanzi_48x48_dict
xs = x
ys = y
#定义字体颜色,RGB888转RGB565
fc = ((color[0]>>3)<<11) + ((color[1]>>2)<<5) + (color[2]>>3) # 字体
bc = ((backcolor[0]>>3)<<11) + ((backcolor[1]>>2)<<5) + (backcolor[2]>>3) # 字体背景颜色
for i in range(0, len(text)):
ch_buf =chinese_dict[text[i]] #汉子对应码表
rgb_buf = []
t1 = font_size[size] // 8
t2 = font_size[size] % 8
for i in range(0, len(ch_buf)):
for j in range(0, 8):
if (ch_buf[i] << j) & 0x80 == 0x00:
rgb_buf.append(bc & 0xff)
rgb_buf.append(bc >> 8)
else:
rgb_buf.append(fc & 0xff)
rgb_buf.append(fc >> 8)
d.write_buf(bytearray(rgb_buf),xs,y,font_size[size],font_size[size])
xs += font_size[size]
printChinese('零一科技',0,0,color=RED,backcolor=BLACK,size=1)
printChinese('零一科技',0,16,color=GREEN,backcolor=BLACK,size=2)
printChinese('零一科技',0,40,color=BLUE,backcolor=BLACK,size=3)
printChinese('零一科技',0,72,color=WHITE,backcolor=BLACK,size=4)
printChinese('零一科技',0,120,color=WHITE,backcolor=BLACK,size=5)