/*灌水艺术字*/
#include <stdio.h>
#define high 0x00FF
#define low 0xFF00
int main()
{
FILE *HZK,*fp;
int i,j,k;
unsigned int buffer[16],myhigh,mylow;
unsigned char chinease[2]="吐";
unsigned char blank[]="",font[]="",ch;
if ((HZK=fopen("d:/software/Ucdos/HZK16","rb"))!=NULL){
fp=fopen("e:/font1.txt","wt+");
/*获得区码与位码*/
i=chinease[0]-0xa0;
j=chinease[1]-0xa0;
fseek(HZK,(94*(i-1)+(j-1))*32L,SEEK_SET);
fread(buffer,32,1,HZK);
for(i=0;i<16;i++)
{
myhigh=(buffer[i] & high)<<8;
mylow=(buffer[i] & low)>>8;
buffer[i]=myhigh | mylow; /*交换高低位,因为读入时高低位与实际相反*/
for(k=1;k<=2;k++)
{
for(j=0;j<16;j++)
{
if(buffer[i] & (0x8000>>j)){
fwrite(font,6,1,fp);
fwrite(font,6,1,fp);
}
else
{
fwrite(blank,6,1,fp);
fwrite(blank,6,1,fp);
}
}
fputc('\n',fp);
}
}
fclose(fp);
fclose(HZK);
puts("finish.");
getch();
}
return 0;
}
程序中需要HZK16字库文件
下面是个范例
[此贴子已经被作者于2007-2-27 15:34:53编辑过]