HZK24.H
上传用户:phillytech
上传日期:2007-01-07
资源大小:561k
文件大小:1k
- ////////////////////////////////////
- // 西文状态下实现汉字输出 (hzk24)//
- // hzk24.h 郁明 F_FIRE@990.net //
- ////////////////////////////////////
- #include <stdlib.h>
- #include <stdio.h>
- #include <graphics.h>
- #include <string.h>
- #define HZK24c "hzk24k"
- #define HZK24t "hzk24t"
- int test(unsigned int a,int k)
- {
- a<<=(k-1);
- if(a&0x80)
- return (1);
- else
- return (0);
- }
- void hz24(int X,int Y,char *zw,int c)
- {
- register unsigned int n=0;
- while(n!=strlen(zw)){ register unsigned int i=0,j=0,l=0;
- register unsigned long xx=0;
- register unsigned long yy=0;
- FILE *fp;char *wm; register unsigned long num=0;
- if((zw[n]&0x80)==0)
- {if(zw[n]==' '){X=X+24;yy=0;n++;}else{
- fp=fopen(HZK24t,"rb++");
- if(fp==NULL){exit(0);}
- num=188+zw[n]-33;
- fseek(fp,(72)*num,0);
- fread(wm,72,1,fp);
- fclose(fp);
- for(i=0;i<24;i++)
- {
- for(j=0;j<3;j++)
- {for(l=1;l<=8;l++)
- if(test(wm[i*3+j],l)==1)
- {putpixel((X+xx),(Y+yy),c);yy++;}
- else{yy++;}
- }
- X++;yy=0;}
- n+=1;}
- }else{
- fp=fopen(HZK24c,"rb++");
- if(fp==NULL){exit(0);}
- zw[n]=zw[n]-0xa0-15;
- zw[n+1]=zw[n+1]-0xa0;
- num=(zw[n]-1)*94+(zw[n+1]-1);
- fseek(fp,(72)*num,0);
- fread(wm,72,1,fp);
- fclose(fp);
- for(i=0;i<24;i++)
- {
- for(j=0;j<3;j++)
- {for(l=1;l<=8;l++)
- if(test(wm[i*3+j],l)==1)
- {putpixel((X+xx),(Y+yy),c);yy++;}
- else{yy++;}
- }
- X++;yy=0;
- }
- n+=2;yy=0;}
- }
- }