#include <stdio.h>
void draw_ch(void *ch);
void outtext(unsigned char *string);
char ziku[94][94][32];
int main()
{
FILE *fp = NULL;
char *toShow = "分就爱上了福建省的浪费就死定了";
if((fp = fopen("ziku.bin","rb")) == NULL)
{
printf("字库打开失败!!\n");
}
else
{
fread((void *)ziku,32,94*94,fp);
printf("字库读取完毕!!\n");
}
outtext((unsigned char *)toShow);
}
void outtext(unsigned char *string)
{
while(*string)
{
if(*string < 0x80)//显示ansi字符,占一个字节
{
printf("不支持Ansi字符显示\n");
}
else if((*string > 0xa0))//显示GB2312字符,占位两个字节
{
//if(size == FONTSIZE16)
//{
// if(style == FONTSTYLE_SONG)
draw_ch((void *)ziku[*string - 0xa1][*(string+1) - 0xa1]);
// else
// lcd_draw_ch(x,y,color,size,(void *)gb2312_ch_16_kaiti[*string - 0xa1][*(string+1) - 0xa1]);
//}
//else/*size == FONTSIZE32*/
//{
// if(style == FONTSTYLE_SONG)
// lcd_draw_ch(x,y,color,size,(void *)gb2312_ch_32_songti[*string - 0xa1][*(string+1) - 0xa1]);
// else
// lcd_draw_ch(x,y,color,size,(void *)gb2312_ch_32_kaiti[*string - 0xa1][*(string+1) - 0xa1]);
//}
string+=2;
}
else
{
}
/*change x to display next character*/
}
}
char g_mask[8] = {0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80};
/*函数说明
*在指定坐标处显示一个字符
*/
void draw_ch(void *ch)
{
int i ;
int j ;
int pix_count = 0;
for(i = 0;i<16;i++)
{
for(j = 0;j<16;j++)
{
if(*((char *)ch + pix_count/8) & g_mask[7 - pix_count%8])
{
printf("■");
}
else
{
printf("□");
}
pix_count++;
}
printf("\n");
}
printf("\n");
}