📄
字号:
#include<process.h>
#include<dos.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<alloc.h>
#include<graphics.h>
#include<fcntl.h>
#include<string.h>
#include<io.h>
#include "chinese.h"
FILE *handle,*handle1;
int fh=0;
unsigned int readCount_0,byteNum_0,readCount_8,byteNum_8;
unsigned char *wordCont_0,*wordCont_8;
double scalceX=0.2,scalceY=0.2;
int Color;
void showHanzi(unsigned char qw,unsigned char wm,int x,int y);
void case8Handle(FILE *handle,unsigned char *case8Data,long basePtr,int x0,int y0);
void otherHandle(int fnNo,unsigned char controlWord,double facX,double facY,int xc,int yc,int *curX,int *curY);
unsigned char myRead_0(void);
unsigned char myRead_8(void);
void b3_4(int *x,int *y);
unsigned char (*fn[2])(void)={myRead_0,myRead_8};
int chinese::openhzk(char c)
{
if(fh==1)
{
fclose(handle);
fclose(handle1);
fh=0;
}
if(c=='s')
{handle=fopen("d:\\ucdos\\fnt\\hzk24s","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='k')
{handle=fopen("d:\\ucdos\\fnt\\hzk24k","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='f')
{handle=fopen("d:\\ucdos\\fnt\\hzk24f","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='b')
{handle=fopen("d:\\ucdos\\fnt\\hzk24h","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='h')
{handle=fopen("d:\\ucdos\\fnt\\hzk40s","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='d')
{handle=fopen("d:\\ucdos\\fnt\\clib48h.dot","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='x')
{handle=fopen("d:\\ucdos\\hzk16","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='p')
{handle=fopen("d:\\ucdos\\fnt\\ktdot.ps","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='1')
{handle=fopen("d:\\ucdos\\fnt\\bsdot.ps","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='2')
{handle=fopen("d:\\ucdos\\fnt\\lsdot.ps","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='3')
{handle=fopen("d:\\ucdos\\fnt\\htdot.ps","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(c=='4')
{handle=fopen("d:\\ucdos\\fnt\\ftdot.ps","rb");
handle1=fopen("d:\\ucdos\\asc16","rb");}
if(handle==NULL || handle1==NULL)
{
cputs("Error on open then lib.");
exit(1);
}
return 0;
fh=1;
}
int chinese::close(void)
{
fclose(handle);
fclose(handle1);
return 0;
}
int chinese::puthz16(int x,int y,int z,int color,char *p)
{
unsigned int i ,c1,c2,m=0;
int i1,i2,i3,rec;
long l;
char by[32];
while ((i=*p++)!=0)
{
if(i>0xa1)
if(m==0)
{
c1=(i-0xa1)&0x7f;
m=1;
}
else
{
c2=(i-0xa1)&0x7f;
m=0;
rec=c1*94+c2;
l=rec*32l;
fseek(handle,l,SEEK_SET);
fread(by,32,1,handle);
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))
putpixel(x+i2*8+i3,y+i1,color);
x=x+16+z;
}
}
return(x);
}
int chinese::puthz16_new(int x,int y,int z,int color,char *p,int maxwidth)
{
unsigned int i,c1,c2,m=0;
int i1,i2,i3,rec,x1;
long l;
char by[32];
while ((i=*p++)!=0)
{
if(i>0xa1)
if(m==0)
{
c1=(i-0xa1)&0x7f;
m=1;
}
else
{
c2=(i-0xa1)&0x7f;
m=0;
rec=c1*94+c2;
l=rec*32l;
fseek(handle,l,SEEK_SET);
fread(by,32,1,handle);
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))
putpixel(x+i2*8+i3,y+i1,color);
x=x+16+z;
if (x>=x1+maxwidth)
{
x=x1;
y=y+20;
}
}
}
return (y+16);
}
int chinese::puthz16a(int x,int y,int z,int color,char *p)
{
unsigned int i ,c1,c2,m=0;
int i1,i2,i3,rec;
long l;
char by[32];
while ((i=*p++)!=0)
{
if(i>0xa1)
{if(m==0)
{
c1=(i-0xa1)&0x7f;
m=1;
}
else
{
c2=(i-0xa1)&0x7f;
m=0;
rec=c1*94+c2;
l=rec*32l;
fseek(handle,l,SEEK_SET);
fread(by,32,1,handle);
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))
putpixel(x+i2*8+i3,y+i1,color);
x=x+16+z;
}
}
else
{
l=i*16l;
fseek(handle1,l,SEEK_SET);
fread(by,16,1,handle1);
for(i1=0;i1<16;i1++)
for(i2=0;i2<8;i2++)
if(getbit(by[i1],7-i2))
putpixel(x+i2,y+i1,color);
x=x+8+z/2;
}
}
return(x);
}
int chinese::puthz24a(int x,int y,int z,int color,char *p)
{
unsigned int i,c1,c2,f=0;
int i1,i2,i3,rec;
long l;
char by[72];
char tt[2];
while ((i=*p++)!=0)
{
if(i>0xa1)
{if(f==0)
{
c1=(i-0xb0)&0x7f;
f=1;
}
else
{
c2=(i-0xa1)&0x7f;
f=0;
rec=c1*94+c2;
l=rec*72l;
fseek(handle,l,SEEK_SET);
fread(by,72,1,handle);
for (i1=0;i1<24;i1++)
for(i2=0;i2<=2;i2++)
for(i3=0;i3<8;i3++)
if(getbit(by[i1*3+i2],7-i3))
putpixel(x+i1,y+i2*8+i3,color);
x=x+24+z;
}
}
else
{
tt[0]=i;
tt[1]='\0';
setcolor(color);
settextstyle(1,HORIZ_DIR,1);
settextjustify(LEFT_TEXT,RIGHT_TEXT);
outtextxy(x,y+4,tt);
x=x+16;
}
}
return(x);
}
int chinese::puthz24(int x,int y,int z,int color,char *p)
{
unsigned int i,c1,c2,f=0;
int i1,i2,i3,rec;
long l;
char by[72];
while ((i=*p++)!=0)
{
if(i>0xa1)
if(f==0)
{
c1=(i-0xb0)&0x7f;
f=1;
}
else
{
c2=(i-0xa1)&0x7f;
f=0;
rec=c1*94+c2;
l=rec*72l;
fseek(handle,l,SEEK_SET);
fread(by,72,1,handle);
for (i1=0;i1<24;i1++)
for(i2=0;i2<=2;i2++)
for(i3=0;i3<8;i3++)
if(getbit(by[i1*3+i2],7-i3))
putpixel(x+i1,y+i2*8+i3,color);
x=x+24+z;
}
}
return(x);
}
int chinese::puthz24_x(int x,int y,int z,int color,char *p,int returnx,int xlimit)
{
unsigned int i,c1,c2,f=0;
int i1,i2,i3,rec;
long l;
char by[72];
while ((i=*p++)!=0)
{
if(i>0xa1)
if(f==0)
{
c1=(i-0xa1)&0x7f;
f=1;
}
else
{
c2=(i-0xa1)&0x7f;
f=0;
rec=c1*94+c2;
l=rec*72l;
fseek(handle,l,SEEK_SET);
fread(by,72,1,handle);
for (i1=0;i1<24;i1++)
for(i2=0;i2<=2;i2++)
for(i3=0;i3<8;i3++)
if(getbit(by[i1*3+i2],7-i3))
putpixel(x+i1,y+i2*8+i3,color);
x=x+24+z;
if(x>xlimit-24)
{
x=returnx;
y=y+30;
}
}
}
return(x);
}
int chinese::puthz24_new(int x,int y,int z,int color,char *p,int maxwidth,int flag)
{
unsigned int i,c1,c2,f=0;
int i1,i2,i3,rec,x1;
long l;
char by[72];
x1=x;
if (flag==2) x=x+48;
while ((i=*p++)!=0)
{
if(i>0xa1)
if(f==0)
{
c1=(i-0xa1)&0x7f;
f=1;
}
else
{
c2=(i-0xa1)&0x7f;
f=0;
rec=c1*94+c2;
l=rec*72l;
fseek(handle,l,SEEK_SET);
fread(by,72,1,handle);
for (i1=0;i1<24;i1++)
for(i2=0;i2<=2;i2++)
for(i3=0;i3<8;i3++)
if(getbit(by[i1*3+i2],7-i3))
putpixel(x+i1,y+i2*8+i3,color);
x=x+24+z;
if(x>=x1+maxwidth)
{
x=x1;
y=y+30;
}
}
}
return(y+30);
}
int chinese::puthz40(int x,int y,int z,int color,char *p,int maxwidth,int flag)
{
unsigned int i,c1,c2,f=0;
int i1,i2,i3,rec,x1;
long l;
char by[180];
x1=x;
if (flag==2) x=x+72;
while ((i=*p++)!=0)
{
if(i>0xa1)
if(f==0)
{
c1=(i-0xa1)&0x7f;
f=1;
}
else
{
c2=(i-0xa1)&0x7f;
f=0;
rec=c1*94+c2;
l=rec*180l;
fseek(handle,l,SEEK_SET);
fread(by,180,1,handle);
for (i1=0;i1<36;i1++)
for(i2=0;i2<3;i2++)
for(i3=0;i3<8;i3++)
if(getbit(by[i1*3+i2],7-i3))
putpixel(x+i1,y+i2*8+i3,color);
for (i1=0;i1<36;i1++)
for(i2=0;i2<2;i2++)
for(i3=0;i3<8;i3++)
if(getbit(by[i1*2+i2+108],7-i3))
putpixel(x+i1,y+24+i2*8+i3,color);
x=x+36+z;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -