- // ------------------ 汉字字模的数据结构定义 ------------------------ //
- struct typFNT_GB16 // 汉字字模数据结构
- {
- unsigned char Index[3]; // 汉字内码索引
- unsigned char Msk[32]; // 点阵码数据
- };
- /////////////////////////////////////////////////////////////////////////
- // 汉字字模表 //
- // 汉字库: 宋体16.dot,横向取模左高位,数据排列:从左到右从上到下 //
- /////////////////////////////////////////////////////////////////////////
- code struct typFNT_GB16 codeGB_16[] = // 数据表
- {
- /*-- 文字: 上 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- "上",0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xF8,0x01,0x00,
- 0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x7F,0xFE,0x00,0x00,
- /*-- 文字: 海 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- "海",0x21,0x00,0x11,0x00,0x11,0xFE,0x02,0x00,0x97,0xF8,0x52,0x88,0x52,0x48,0x12,0x08,
- 0x2F,0xFE,0x22,0x88,0xE2,0x48,0x22,0x08,0x23,0xFE,0x20,0x08,0x20,0x28,0x20,0x10,
- …………
- };
- //调用函数+索引
- void PutGB1616(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int bColor)
- {
- unsigned int i,j,k;
- LCD_SetPos(x, x+16-1,y, y+16-1);
- for (k=0;k<64;k++)
- { //64标示自建汉字库中的个数,循环查询内码
- if ((codeGB_16[k].Index[0]==c[0])&&(codeGB_16[k].Index[1]==c[1]))
- {
- for(i=0;i<32;i++)
- {
- unsigned short m=codeGB_16[k].Msk;
- for(j=0;j<8;j++)
- {
- if((m&0x80)==0x80)
- {
- Write_Data_U16(fColor);
- }
- else
- {
- Write_Data_U16(bColor);
- }
- m<<=1;
- }
- }
- }
- }
- }