(高分)急!C语言编程中如何显示汉字
发布网友
发布时间:2022-04-26 19:32
我来回答
共4个回答
热心网友
时间:2023-10-24 08:34
wintc 自带汉显 字库 可以下来看看
他那个是用点阵显示的 用的是graphics.h这个库
例如
char guan48[]={
/* 以下是 '灌' 的 48点阵黑体 字模,288 byte */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x38,0x00,
0x03,0x00,0x03,0xC0,0x38,0x00,0x07,0x80,
0x03,0xC0,0x38,0x00,0x07,0xC0,0x03,0xC0,
0x38,0x00,0x03,0xF1,0xFF,0xFF,0xFF,0xFC,
0x01,0xF9,0xFF,0xFF,0xFF,0xFC,0x00,0x79,
0xF1,0xC0,0x39,0xFC,0x00,0x30,0x01,0xC0,
0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xF0,0xFF,0xE0,0x00,0x00,0xFF,0xF0,
0xFF,0xE0,0x00,0x00,0xE0,0x70,0xE0,0xE0,
0x0E,0x00,0xE0,0x70,0xE0,0xE0,0x1F,0x80,
0xE0,0x70,0xE0,0xE0,0x1F,0xE0,0xFF,0xF0,
0xFF,0xE0,0x07,0xF0,0xFF,0xF0,0xFF,0xE0,
0x01,0xF0,0xFF,0xF1,0xFF,0xE0,0x00,0x60,
0x08,0x07,0x00,0x00,0x00,0x20,0x1E,0x03,
0x80,0x00,0x00,0x00,0x1E,0x03,0x00,0x00,
0x00,0x00,0x1F,0xFF,0xFF,0xF0,0x00,0x00,
0x3F,0xFF,0xFF,0xF0,0x00,0x00,0x3F,0xFF,
0xFF,0xF0,0x00,0x00,0x7C,0x03,0x80,0x00,
0x00,0x20,0x7C,0x03,0x80,0x00,0x00,0x70,
0xFC,0x03,0x80,0x00,0x00,0x71,0xFF,0xFF,
0xFF,0xE0,0x00,0x73,0xFF,0xFF,0xFF,0xE0,
0x00,0xF3,0xBC,0x03,0x80,0x60,0x00,0xE3,
0xBC,0x03,0x80,0x00,0x01,0xE1,0x3C,0x03,
0x80,0x00,0x01,0xC0,0x3F,0xFF,0xFF,0xE0,
0x01,0xC0,0x3F,0xFF,0xFF,0xE0,0x03,0xC0,
0x3F,0xFF,0xFF,0xE0,0x03,0x80,0x3C,0x03,
0x80,0x00,0x07,0x80,0x3C,0x03,0x80,0x00,
0x0F,0x80,0x3C,0x03,0x80,0x00,0x0F,0x00,
0x3F,0xFF,0xFF,0xF8,0x1F,0x00,0x3F,0xFF,
0xFF,0xF8,0x1F,0x00,0x3C,0x00,0x00,0x00,
0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
热心网友
时间:2023-10-24 08:34
TC的
#include <stdio.h>
#include <alloc.h>
#include <ctype.h>
#include <dos.h>
#include <dir.h>
#include <io.h>
#include <graphics.h>
#define GETADR(n,str) (str *) calloc (n,sizeof(str))
#define W16 16
#define C16 32
unsigned char bit[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
FILE *fi;
char *dot,str[20];
main(int argc,char *argv[])
{
int i,j,nn,xc,yc,MaxX,MaxY,menul[1000];
int graphdriver=DETECT,graphmode;
if(argc!=2){
puts("LT16<???.N4>");
exit(0);
}
dot=GETADR(C16,char);
fnmerge(str,"","",argv[1],".N4");
if((fi=fopen(str,"r"))==NULL){
puts("Can't open DATA.");
exit(0);
}
fscanf(fi,"%d",&nn);
if(nn<=0||nn>1000)
exit(0);
for (i=0;i<nn;i++)
fscanf(fi,"%d",&menul[i]);
fclose(fi);
if((fi=fopen("CLIB16.DOT","rb"))==NULL){
puts("Can't open CLIB16.DOT");
exit(0);
}
initgraph(&graphdriver,&graphmode,"");
MaxX=getmaxx();
MaxY=getmaxy();
xc=0;
yc=20;
for(j=0;j<nn;j++){
i=readlibdot(menul[j]);
putchar16(xc,yc);
xc+=20;
if(xc>MaxX-20){
yc+=20;
xc=0;
if(yc>MaxY-20){
getch();
clearviewport();
yc=0;
}
}
}
getch();
closegraph();
}
readlibdot(int j)
{
int i0,j1,j2;
long order,k1;
j1=j/100;
j2=j-j1*100;
if(j1>=9)
j1=j1-6;
k1=94*j1+j2-95;
order=C16*k1;
fseek(fi,order,SEEK_SET);
i0=fread(dot,C16,1,fi);
return(i0);
}
putchar16(int bx,int by)
{
int i,j,kk,k,x1,y1;
unsigned char marker;
kk=0;
y1=by;
for(i=0;i<16;i++,y1++){
for(j=0;j<2;j++){
x1=bx+j*8;
marker=*(dot+kk);
kk++;
for(k=0;k<8;k++){
if(!(marker&bit[k]))
continue;
putpixel(x1+k,y1,YELLOW);
}
}
}
return;
}
热心网友
时间:2023-10-24 08:35
关键是cc65的编译器的资料
热心网友
时间:2023-10-24 08:36
在写字板里面打好了,然后复制粘贴CONTROL C/V