"国"字的机内码国标码和区位码
 类别   数值 
机内码  B9FAH 
国标码  397AH 
区位码  195AH 
区位码为195AH 换算成十进制为2590 即国字的点阵位
于第25 区的第90 个字的位置相当于在文件HZK16 中的位置为
32 [(25-1) 94 (90-1)] 75040B 以后的32 个字节为国的显示点阵
我只知道这些,可是,那个16进制的文件内的格式是什么?怎样取出这32个字节呢?

解决方案 »

  1.   

    #include "stdio.h"
    #include "stdlib.h"
    #include "dir.h"
    #include "graphics.h"
    #include "process.h"
    #include "io.h"
    #include "fcntl.h"
    #include "bios.h"
    #include "stdarg.h"
    #include "math.h"
    #include "string.h"
    #include "dos.h"/*open Han_zi_ku*/
    extern int handle=0;
    int openhzk(void)
    {
    handle=open("d:cclibj.dot",O_RDWR|O_BINARY);
    if (handle==-1) {
    puts("error on open cclibj.dot");
    exit(0);
    }
    }
    /*********************************/
    int getbit(unsigned char c,int n)
    {
    return((c>>n)&1);
    }/**********************************//*output Han_zi read from Han_zi_ku*/
     void puthz(int x3,int y3,unsigned char *p,int e_color, int c_color,int ln,int cl,int size,int ii)
    {
    unsigned int x1,y1,c1,c2,f=0;
    unsigned char i[2];
    int  i1,i2,i3,j1,j2;
    long   l;
    char     by[32];
    i[1]='\0';
    setcolor(e_color);
    setusercharsize(9,5,9,5);
    x1=x3;
    y1=y3;
    while ((i[0]=*p++)!=0&&(i[0]!='!'))
     {
     if (i[0]<0xa0)
     {
     if (i[0]!=13&i[0]!=10&i[0]!='@')
       {
       settextstyle(0,0,size);
       if (size==1) outtextxy(x3,y3+4,i);
       else outtextxy(x3,y3,i);
       f=0;
       x3+=(8*size+1);
       }
       if (x3>(ii-8*size)||(i[0]=='@'))
       {
       x3=x1;
       y3+=18*size;
       }
      }
     else
        {
        if (f==0) {
           if(i[0]>=0xb0) c1=(i[0]-0xa0-7)*94;
           else c1=(i[0]-0xa1)*94;
           f++;
          }
        else{
     c2=i[0]-0xa0+c1-1;
     f=0;
     l=c2*32L;
        lseek(handle,l,SEEK_SET);
     read(handle,by,32);
     for(i1=0;i1<16;i1++)
      for(i2=0;i2<2;i2++)
       for(i3=0;i3<8;i3++)
        if(getbit(by[i1*2+i2],7-i3))
     {for(j1=0;j1<ln;j1++)
     for(j2=0;j2<cl;j2++)
     putpixel(x3+(i2*8+i3)*ln+j1,y3+i1*cl+j2,c_color);
     }
     x3+=(16*ln+1);
     if(x3>(ii-16*ln))
     {
     x3=x1;
     y3+=18*cl;
     if((y3>479-16*cl)) return;
     }
           }
        }
     }
    }/*****************************/
    void closehzk()
    {
    close(handle);
    }
      

  2.   

    文件格式非常简单,就是一些32字节的数据,按行排列
    byte0  byte1
    byte2  byte3
    ...
    byte30 byte31
    每个字节是8个点阵。
      

  3.   

    建议你查一下国标GB2302,汉字的内码是分区段连续的,比如第一个字啊从B0A1开始,字库的结构也是按照这个顺序排下来的,比如B0A3就应该是比啊字的字模位置偏移64个字节(16点阵汉字一个字的字模32个字节),算法不难,找到规律就好了。