TFT2.4彩屏2 [32*32文字顯示]
>_<:同理如果想顯示其他形式的字體,就要建立相應(yīng)的庫啦,如這里還有一個(gè)gb3232的漢字庫:GB3232.h
1 // ------------------ 漢字字模的數(shù)據(jù)結(jié)構(gòu)定義 ------------------------ //
2 struct typFNT_GB32 // 漢字字模數(shù)據(jù)結(jié)構(gòu)
3 {
4 unsigned char Index[3]; // 漢字內(nèi)碼索引
5 unsigned char Msk[128]; // 點(diǎn)陣碼數(shù)據(jù)
6 };
7
8 /////////////////////////////////////////////////////////////////////////
9 // 漢字字模表 //
10 // 漢字庫: 宋體32.dot,橫向取模左高位,數(shù)據(jù)排列:從左到右從上到下 //
11 /////////////////////////////////////////////////////////////////////////
12 code struct typFNT_GB32 codeGB_32[] = // 數(shù)據(jù)表
13 {
14 /*-- 文字: 我 --*/
15 /*-- 宋體22; 此字體下對應(yīng)的點(diǎn)陣為:寬x高=29x29 --*/
16 /*-- 寬度不是8的倍數(shù),現(xiàn)調(diào)整為:寬度x高度=32x29 --*/
17 "我",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0xC0,0x00,0x00,0x7D,0xF8,0x00,
18 0x03,0xFD,0xCE,0x00,0x3F,0xC1,0xC7,0x00,0x00,0xC1,0xC7,0x00,0x00,0xC1,0xC3,0x00,
19 0x00,0xC1,0xC3,0x00,0x00,0xC1,0xC0,0xC0,0x3F,0xFF,0xFF,0xE0,0x20,0xC0,0xC0,0x00,
20 0x00,0xC0,0xC2,0x00,0x00,0xC0,0xC7,0x80,0x00,0xC2,0xC7,0x80,0x00,0xDE,0xCF,0x00,
21 0x00,0xF8,0xCE,0x00,0x0F,0xE0,0xFC,0x00,0x7F,0xC0,0xF8,0x00,0x3C,0xC0,0x78,0x00,
22 0x30,0xC0,0x70,0x20,0x00,0xC1,0xF8,0x20,0x00,0xC3,0xB8,0x20,0x00,0xC7,0x1E,0x20,
23 0x00,0xDC,0x0F,0x60,0x0F,0xF0,0x07,0xE0,0x03,0xC0,0x03,0xF0,0x01,0x80,0x00,0x70,
24 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
25
26 /*-- 文字: 愛 --*/
27 /*-- 宋體22; 此字體下對應(yīng)的點(diǎn)陣為:寬x高=29x29 --*/
28 /*-- 寬度不是8的倍數(shù),現(xiàn)調(diào)整為:寬度x高度=32x29 --*/
29 "愛",0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3F,0x80,0x00,0x3F,0xFF,0x80,
30 0x0F,0xFF,0x06,0x00,0x01,0x86,0x0F,0x00,0x00,0xC3,0x0E,0x00,0x00,0xE3,0x9C,0x00,
31 0x08,0x63,0x98,0x00,0x08,0x41,0x10,0xC0,0x0F,0xFF,0xFF,0xE0,0x18,0x18,0x01,0xC0,
32 0x38,0x1C,0x01,0x80,0x38,0x1C,0x03,0x00,0x0F,0xFF,0xFF,0x00,0x0F,0xFF,0xFF,0x00,
33 0x00,0x38,0x00,0x00,0x00,0x3F,0xFC,0x00,0x00,0x3F,0xFE,0x00,0x00,0x7C,0x1C,0x00,
34 0x00,0x6C,0x38,0x00,0x00,0xC6,0x70,0x00,0x01,0xC3,0xE0,0x00,0x03,0x81,0xC0,0x00,
35 0x07,0x07,0xFC,0x00,0x0C,0x1E,0x3F,0xF0,0x38,0xF8,0x0F,0xE0,0x03,0xC0,0x00,0xC0,
36 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
37
38 /*-- 文字: 單 --*/
39 /*-- 宋體22; 此字體下對應(yīng)的點(diǎn)陣為:寬x高=29x29 --*/
40 /*-- 寬度不是8的倍數(shù),現(xiàn)調(diào)整為:寬度x高度=32x29 --*/
41 "單",0x00,0x00,0x00,0x00,0x00,0x80,0x30,0x00,0x00,0xE0,0x38,0x00,0x00,0x70,0x38,0x00,
42 0x00,0x38,0x60,0x00,0x00,0x38,0x60,0x00,0x06,0x10,0xC6,0x00,0x07,0xFF,0xFF,0x00,
43 0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,0x07,0xFF,0xFE,0x00,
44 0x07,0xFF,0xFE,0x00,0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,
45 0x07,0xFF,0xFE,0x00,0x07,0x06,0x06,0x00,0x06,0x06,0x00,0x00,0x00,0x06,0x00,0xE0,
46 0x7F,0xFF,0xFF,0xF0,0x20,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,
47 0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,
48 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
49
50 /*-- 文字: 片 --*/
51 /*-- 宋體22; 此字體下對應(yīng)的點(diǎn)陣為:寬x高=29x29 --*/
52 /*-- 寬度不是8的倍數(shù),現(xiàn)調(diào)整為:寬度x高度=32x29 --*/
53 "片",0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x01,0x00,0xF0,0x00,0x01,0xC0,0xE0,0x00,
54 0x01,0xC0,0xE0,0x00,0x01,0x80,0xE0,0x00,0x01,0x80,0xE0,0x00,0x01,0x80,0xE0,0x00,
55 0x01,0x80,0xE0,0x80,0x01,0x80,0xE1,0xC0,0x01,0xFF,0xFF,0xE0,0x01,0x80,0x00,0x00,
56 0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x30,0x00,0x01,0xFF,0xF8,0x00,
57 0x01,0xFF,0xF8,0x00,0x01,0x80,0x30,0x00,0x03,0x80,0x30,0x00,0x03,0x80,0x30,0x00,
58 0x03,0x00,0x30,0x00,0x07,0x00,0x30,0x00,0x06,0x00,0x30,0x00,0x0E,0x00,0x30,0x00,
59 0x0C,0x00,0x30,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x38,0x00,0x20,0x00,0x30,0x00,
60 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
61
62 /*-- 文字: 機(jī) --*/
63 /*-- 宋體22; 此字體下對應(yīng)的點(diǎn)陣為:寬x高=29x29 --*/
64 /*-- 寬度不是8的倍數(shù),現(xiàn)調(diào)整為:寬度x高度=32x29 --*/
65 "機(jī)",0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x03,0x06,0x06,0x00,
66 0x03,0x07,0xFF,0x00,0x03,0x07,0x0F,0x00,0x03,0x07,0x0E,0x00,0x03,0x37,0x0E,0x00,
67 0x7F,0xF7,0x0E,0x00,0x3F,0xFF,0x0E,0x00,0x03,0x07,0x0E,0x00,0x07,0x07,0x0E,0x00,
68 0x07,0x87,0x0E,0x00,0x07,0xE7,0x0E,0x00,0x0F,0x77,0x0E,0x00,0x0F,0x3F,0x0E,0x00,
69 0x0F,0x17,0x0E,0x00,0x1B,0x07,0x0E,0x00,0x1B,0x06,0x0E,0x00,0x33,0x06,0x0E,0x00,
70 0x33,0x06,0x0E,0x20,0x63,0x0E,0x0E,0x60,0x43,0x0C,0x0E,0x60,0x03,0x1C,0x0E,0x60,
71 0x03,0x18,0x0E,0x70,0x03,0x30,0x07,0xF0,0x03,0x60,0x07,0xE0,0x03,0x40,0x00,0x00,
72 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
73
74 };
>_<:則模仿上一個(gè)博客里彩屏模版里的的GB1616的代碼有:
1 #include "GB3232.h" //32*32漢字字模
2
3 void PutGB3232(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int bColor){
4 unsigned int i,j,k;
5
6 LCD_SetPos(x, x+32-1,y, y+32-1);
7
8 for (k=0;k<5;k++) { //5標(biāo)示自建漢字庫中的個(gè)數(shù),循環(huán)查詢內(nèi)碼
9 if ((codeGB_32[k].Index[0]==c[0])&&(codeGB_32[k].Index[1]==c[1])){
10 for(i=0;i<128;i++) {
11 unsigned short m=codeGB_32[k].Msk[i];
12 for(j=0;j<8;j++) {
13 if((m&0x80)==0x80) {
14 Write_Data_U16(fColor);
15 }
16 else {
17 Write_Data_U16(bColor);
18 }
19 m<<=1;
20 }
21 }
22 }
23 }
24 }