巧用SETLINESTYLE实现汉字的显示

Author: Date: 1994-10-07

        下面提供了一个较详细的源程序供读者参考,其中XDMCHINA()是显示汉字的子函数,可不经修改被其它过程调用。
        #include "graphics.h"
        #include "stdio.h"
        int I,J,L;
        long A,B,C,E,F;
        main()
        {
        int DRIVER,MODE;
             void xdmchina();
             void page1();
             DRIVER=VGA;
             MODE=VGAHI;
             initgraph(&DRIVER,&MODE,"");
             page1();
        }
        void xdmchina(int X,int Y,char S)
        {
             FILE *FI;
             if((FI=fopen("c:cclib","rb"))==NULL)  exit(0);
             L=strlen(S)/2;
             for (I=0;I<L;I++) {
               A=(S&0x7f)-0x21;
               B=(S&0x7f)-0x21;
        if(A>=15) A=A-6;
        C=(A*94+B)*32;
        fseek(FI,C,SEEK_SET);
        for (J=0;J<16;J++) {
                   fscanf(FI,"%c",&E);
        fscanf(FI,"%c",&F);
        C=E*256+F;
        setlinestyle(4,C,1);                                      line(X+I*16+15,Y+J,X+I*16,Y+J);
                }
        }
        }
        void page1()
        {
            setcolor(12);
            xdmchina(5,1,"程序设计:谢笛鸣");
            getch();
        }