这是dos下读取ucdos的kzk16的c程序,估计你要字库的结构。
#include <stdio.h>
#include <graphics.h>
#include <conio.h>
void showhz(FILE *fp,unsigned char *OneHz);
void main()
{
FILE *fp;
int gdriver = DETECT, gmode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "c://tc//bgi");
fp=fopen("hzk16","rb");
showhz(fp,"我");
getch();
closegraph();
}
void showhz(FILE *fp,unsigned char *OneHz)
{
long offset=32l*((OneHz[0]-0xa1)*94+OneHz[1]-0xa1);
unsigned char dotarray[32];
int x,y,i,j,k,l;
unsigned char bitarray[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
fseek(fp,offset,0);
for (i=0;i<32;i++)
{
dotarray=fgetc(fp);
}
for (j=0;j<16;j++)
for(k=0;k<2;k++)
for (l=0;l<8;l++)
{
x=k*8+l;
y=j;
if (dotarray[j*2+k]&bitarray[l])
putpixel(x,y,RED);
else
putpixel(x,y,BLACK);
}
}