>_<:同理如果想显示其他形式的字体,就要建立相应的库啦,如这里还有一个gb3232的汉字库:GB3232.h
// ------------------ 汉字字模的数据结构定义 ------------------------ //
struct typFNT_GB32 // 汉字字模数据结构
{
unsigned char Index[]; // 汉字内码索引
unsigned char Msk[]; // 点阵码数据
}; /////////////////////////////////////////////////////////////////////////
// 汉字字模表 //
// 汉字库: 宋体32.dot,横向取模左高位,数据排列:从左到右从上到下 //
/////////////////////////////////////////////////////////////////////////
code struct typFNT_GB32 codeGB_32[] = // 数据表
{
/*-- 文字: 我 --*/
/*-- 宋体22; 此字体下对应的点阵为:宽x高=29x29 --*/
/*-- 宽度不是8的倍数,现调整为:宽度x高度=32x29 --*/
"我",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0xC0,0x00,0x00,0x7D,0xF8,0x00,
0x03,0xFD,0xCE,0x00,0x3F,0xC1,0xC7,0x00,0x00,0xC1,0xC7,0x00,0x00,0xC1,0xC3,0x00,
0x00,0xC1,0xC3,0x00,0x00,0xC1,0xC0,0xC0,0x3F,0xFF,0xFF,0xE0,0x20,0xC0,0xC0,0x00,
0x00,0xC0,0xC2,0x00,0x00,0xC0,0xC7,0x80,0x00,0xC2,0xC7,0x80,0x00,0xDE,0xCF,0x00,
0x00,0xF8,0xCE,0x00,0x0F,0xE0,0xFC,0x00,0x7F,0xC0,0xF8,0x00,0x3C,0xC0,0x78,0x00,
0x30,0xC0,0x70,0x20,0x00,0xC1,0xF8,0x20,0x00,0xC3,0xB8,0x20,0x00,0xC7,0x1E,0x20,
0x00,0xDC,0x0F,0x60,0x0F,0xF0,0x07,0xE0,0x03,0xC0,0x03,0xF0,0x01,0x80,0x00,0x70,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*-- 文字: 爱 --*/
/*-- 宋体22; 此字体下对应的点阵为:宽x高=29x29 --*/
/*-- 宽度不是8的倍数,现调整为:宽度x高度=32x29 --*/
"爱",0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3F,0x80,0x00,0x3F,0xFF,0x80,
0x0F,0xFF,0x06,0x00,0x01,0x86,0x0F,0x00,0x00,0xC3,0x0E,0x00,0x00,0xE3,0x9C,0x00,
0x08,0x63,0x98,0x00,0x08,0x41,0x10,0xC0,0x0F,0xFF,0xFF,0xE0,0x18,0x18,0x01,0xC0,
0x38,0x1C,0x01,0x80,0x38,0x1C,0x03,0x00,0x0F,0xFF,0xFF,0x00,0x0F,0xFF,0xFF,0x00,
0x00,0x38,0x00,0x00,0x00,0x3F,0xFC,0x00,0x00,0x3F,0xFE,0x00,0x00,0x7C,0x1C,0x00,
0x00,0x6C,0x38,0x00,0x00,0xC6,0x70,0x00,0x01,0xC3,0xE0,0x00,0x03,0x81,0xC0,0x00,
0x07,0x07,0xFC,0x00,0x0C,0x1E,0x3F,0xF0,0x38,0xF8,0x0F,0xE0,0x03,0xC0,0x00,0xC0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*-- 文字: 单 --*/
/*-- 宋体22; 此字体下对应的点阵为:宽x高=29x29 --*/
/*-- 宽度不是8的倍数,现调整为:宽度x高度=32x29 --*/
"单",0x00,0x00,0x00,0x00,0x00,0x80,0x30,0x00,0x00,0xE0,0x38,0x00,0x00,0x70,0x38,0x00,
0x00,0x38,0x60,0x00,0x00,0x38,0x60,0x00,0x06,0x10,0xC6,0x00,0x07,0xFF,0xFF,0x00,
0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,0x07,0xFF,0xFE,0x00,
0x07,0xFF,0xFE,0x00,0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,0x07,0x06,0x06,0x00,
0x07,0xFF,0xFE,0x00,0x07,0x06,0x06,0x00,0x06,0x06,0x00,0x00,0x00,0x06,0x00,0xE0,
0x7F,0xFF,0xFF,0xF0,0x20,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,
0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*-- 文字: 片 --*/
/*-- 宋体22; 此字体下对应的点阵为:宽x高=29x29 --*/
/*-- 宽度不是8的倍数,现调整为:宽度x高度=32x29 --*/
"片",0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x01,0x00,0xF0,0x00,0x01,0xC0,0xE0,0x00,
0x01,0xC0,0xE0,0x00,0x01,0x80,0xE0,0x00,0x01,0x80,0xE0,0x00,0x01,0x80,0xE0,0x00,
0x01,0x80,0xE0,0x80,0x01,0x80,0xE1,0xC0,0x01,0xFF,0xFF,0xE0,0x01,0x80,0x00,0x00,
0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x30,0x00,0x01,0xFF,0xF8,0x00,
0x01,0xFF,0xF8,0x00,0x01,0x80,0x30,0x00,0x03,0x80,0x30,0x00,0x03,0x80,0x30,0x00,
0x03,0x00,0x30,0x00,0x07,0x00,0x30,0x00,0x06,0x00,0x30,0x00,0x0E,0x00,0x30,0x00,
0x0C,0x00,0x30,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x38,0x00,0x20,0x00,0x30,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*-- 文字: 机 --*/
/*-- 宋体22; 此字体下对应的点阵为:宽x高=29x29 --*/
/*-- 宽度不是8的倍数,现调整为:宽度x高度=32x29 --*/
"机",0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x03,0x06,0x06,0x00,
0x03,0x07,0xFF,0x00,0x03,0x07,0x0F,0x00,0x03,0x07,0x0E,0x00,0x03,0x37,0x0E,0x00,
0x7F,0xF7,0x0E,0x00,0x3F,0xFF,0x0E,0x00,0x03,0x07,0x0E,0x00,0x07,0x07,0x0E,0x00,
0x07,0x87,0x0E,0x00,0x07,0xE7,0x0E,0x00,0x0F,0x77,0x0E,0x00,0x0F,0x3F,0x0E,0x00,
0x0F,0x17,0x0E,0x00,0x1B,0x07,0x0E,0x00,0x1B,0x06,0x0E,0x00,0x33,0x06,0x0E,0x00,
0x33,0x06,0x0E,0x20,0x63,0x0E,0x0E,0x60,0x43,0x0C,0x0E,0x60,0x03,0x1C,0x0E,0x60,
0x03,0x18,0x0E,0x70,0x03,0x30,0x07,0xF0,0x03,0x60,0x07,0xE0,0x03,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, };
>_<:则模仿上一个博客里彩屏模版里的的GB1616的代码有:
#include "GB3232.h" //32*32汉字字模 void PutGB3232(unsigned short x, unsigned short y, unsigned char c[], unsigned int fColor,unsigned int bColor){
unsigned int i,j,k; LCD_SetPos(x, x+-,y, y+-); for (k=;k<;k++) { //5标示自建汉字库中的个数,循环查询内码
if ((codeGB_32[k].Index[]==c[])&&(codeGB_32[k].Index[]==c[])){
for(i=;i<;i++) {
unsigned short m=codeGB_32[k].Msk[i];
for(j=;j<;j++) {
if((m&0x80)==0x80) {
Write_Data_U16(fColor);
}
else {
Write_Data_U16(bColor);
}
m<<=;
}
}
}
}
}