|  『第 4 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
是自己写C程序吗?Turbo c下,可以自己从字体文件中提取字模,然后画出来就可以了。
 给你一段代码吧。字模文件你可以在本论坛上找到很多--HZK16
 代码如下:
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <dos.h>
 #include <conio.h>
 #include <graphics.h>
 int disphz(int left,int top,unsigned char byte1,unsigned char byte2,int color)
 {
 FILE *fp;
 struct linesettingstype oldlinetype;unsigned int buf[16];
 unsigned char mark;long p;int x,y,i;int qu,wei;
 unsigned int linetypedata[16];
 if ((fp=fopen("hzk16f","rb"))==NULL)
 {
 outtextxy(10,10,"can't open HZ16_file!");
 exit(0);
 }
 qu=byte1-0xa0;wei=byte2-0xa0;
 p=(qu-1)*94+wei-1;p*=32;
 fseek(fp,(long)p,SEEK_SET);
 fread(buf,2,16,fp);
 fclose(fp);
 for (i=0;i<16;i++)
 {
 linetypedata[i]=(buf[i]<<8&0xff00)|(buf[i]>>8&0x00ff);
 }
 x=left+15;setcolor(color);
 getlinesettings(&oldlinetype);
 for (i=0,y=top;i<16;i++,y++)
 {
 setlinestyle(4,linetypedata[i],1);
 moveto(left,y);
 lineto(x,y);
 }
 setlinestyle(oldlinetype.linestyle,oldlinetype.upattern,oldlinetype.thickness);
 return;
 }
 
 int outhz(int x,int y,char *p,int color)
 {
 int oldcolor=getcolor();
 setcolor(color);
 while (*p)
 {
 if (x>639||y>479)
 return 0;
 if (((unsigned char)*p>=0xa1&&(unsigned char)*p<=0xfe)&&((unsigned char)*(p+1)>=0xa1&&(unsigned char)*(p+1)<=0xfe))
 {
 disphz(x,y,*p,*(p+1),color);
 p+=2;
 x+=18;
 moveto(x,y);
 }
 else
 {
 unsigned char *q[2];
 moveto(x,y);
 *q=*p;
 *(q+1)='\0';
 settextstyle(0,0,1);
 outtextxy(x,y+4,q);
 x+=9;
 p++;
 }
 }
 setcolor(oldcolor);
 }
 
 int main()
 {
 int gd=VGA,gm=VGAHI;
 registerbgidriver(EGAVGA_driver); /*如果你的g没有先编译EGAVGA加到graphics.lib 请注释掉此句*/
 initgraph(&gd,&gm,"");
 outhz(100,100,"你好!测试一下程序ABCabc123",WHITE);
 outhz(100,120,"同是一颗金星,早上,人们叫它启明,傍晚,人们叫它长庚。",WHITE);
 getch();
 closegraph();
 clrscr();
 return 0;
 }
 
 
 
 | 此帖被 +4 点积分  点击查看详情 | 评分人:【 HAT 】 | 分数: +4 | 时间:2009-2-14 13:51 | 
 | 
 
 
 
 |