China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 18:15
Original Poster Posted 2005-07-17 18:49 ·  中国 广东 深圳 福田区 电信
初级用户
Credits 94
Posts 9
Joined 2005-07-17 17:37
20-year member
UID 40811
Status Offline
Floor 2 Posted 2005-07-17 22:35 ·  中国 广东 广州 白云区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
Your question reminds me of my high school days.

When I was a freshman in high school (that was in 1999), I borrowed a C language application program from the school library (I can't remember the title and publisher, but I only remember that the title had the word "application". This book was awesome! Although the book was not big or thick, it had source programs for reading various vector fonts of UCDOS and making effects such as font deformation, rotation, filling, hollow characters, etc., as well as sample programs for reading and displaying BMP pictures and a Minesweeper game program! These programs were all source programs developed under Turbo C 2.0! I only borrowed this book once and also typed a few precious source programs on the computer, and then returned the book. Who knew that a year later, my computer was infected with a hateful virus, the hard disk partition table was damaged, and the data inside the hard disk was also rewritten by the virus. I had to reluctantly part with it, re-partition and format, and the precious source programs were all gone... After returning the book, I never found this book again. The library was relatively small with not many collections. When I used the computer to search for this book, the result showed that there was only one copy. Every time I went to the library, I often went to look for this treasure book and also contacted and helped the librarian. Until I graduated from high school, I still couldn't find it. I guessed that the book was lost, and there was no book on C language applications on the market that could compare with it, which left a big regret in my high school days.

After entering college, I started to get in touch with the Internet and felt that it was already an era dominated by Windows programming such as VB, VC, etc. QB and C programming under DOS were already outdated, and the value of research and utilization had been greatly reduced. Moreover, restricted by my major, I never spent any more effort on studying programming.

Okay, having said so much, although the book is hard to find, I think these programs should be found on forums such as ProgramFan, QB, etc. Come on, the owner!
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 3 Posted 2005-07-25 18:35 ·  中国 湖北 武汉 联通
高级用户
★★★
Credits 587
Posts 302
Joined 2005-07-25 17:31
20-year member
UID 41046
Gender Male
Status Offline
It seems that UCDOS provides examples during the installation.
Floor 4 Posted 2005-07-25 23:15 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
The routines provided by UCDOS seem to be only for dot - matrix fonts, and it seems there is no application of vector fonts. I haven't used UCDOS for a long time...
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 5 Posted 2005-09-08 16:56 ·  中国 广东 深圳 宝安区 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
20-year member
UID 41110
Gender Male
From 广东深圳
Status Offline

/***** From http://www.moon-soft.com/program/doc/docelite1257.htm ****/

/* Asking about the UCDOS vector font algorithm */
/* Reading and displaying vector Chinese characters */
#include <stdio.h>

#include <graphics.h>

#define HZNUM (0xf7 - 0xaf) * (0xfe - 0xa0) /* All Chinese characters except the first 16 areas */
#define HZKSIZE 128 /* Size of Chinese characters */
#define START_X 0
#define START_Y 0
#define VIEW_H 256 /* Height of displayed Chinese characters */
#define VIEW_W 256 /* Width of displayed Chinese characters */
FILE * fp;
struct hz_struct {
unsigned long shift; /* Offset */
unsigned int size; /* Size */
}
HZ_Index; /* Chinese character index */
unsigned char buf;
unsigned char dotbuf;
main() {
long ioffset;
int i, j;
char ch;
int gdriver = DETECT;
int gmode;
if ((fp = fopen("hzksly1j", "rb")) == NULL) {
printf("cano't open the HZlib!");
exit(1);
}
fread(HZ_Index, sizeof(struct hz_struct), HZNUM, fp);
//if (registerbgidriver(EGAVGA_driver) < 0)
exit(1);
initgraph( & gdriver, & gmode, "");
cleardevice();
setcolor(LIGHTGRAY);
for (i = 0; i < HZNUM; i++) {
Disp_HZ(HZ_Index.size, HZ_Index.shift);
rectangle(START_X, START_Y, START_X + 256, START_Y + 256);
ch = getch();
cleardevice();
if (ch == 'q')
break;
}
closegraph();
fclose(fp);
}

/* Display Chinese character */
Disp_HZ(int length, long posi) {
int i, j, k;
int x0, y0, x1, y1;
int hzsize;
union utype {
unsigned short size;
unsigned char str;
}
BH;
if ((fseek(fp, posi, 0)) != 0) {
printf("seek\"clib\"error!\n");
exit(0);
}
memset(buf, 0, 1024);
fread(buf, length, 1, fp);
hzsize = decode(buf, length);
k = 0;
for (i = 0; i < hzsize; i++) {
BH.str = dotbuf;
BH.str = dotbuf;
if (BH.size == 0)
break; /* Each Chinese character ends with 0 */
x0 = START_X + (dotbuf * VIEW_W) / HZKSIZE;
y0 = START_Y + (dotbuf * VIEW_H) / HZKSIZE;
//x0 = START_X + dotbuf;
//y0 = START_Y + dotbuf;
moveto(x0, y0);
for (j = 0; j < BH.size - 1; j++) {
x1 = START_X + (dotbuf * VIEW_W) / HZKSIZE;
y1 = START_Y + (dotbuf * VIEW_W) / HZKSIZE;
//x1 = START_X + dotbuf;
//y1 = START_Y + dotbuf;
lineto(x1, y1);
}
lineto(x0, y0);
}
}

/*
* Restore Chinese character glyphs
*/
decode(p, length)
unsigned char * p;
int length; {
int k;
int i, count, lposi, xsum, ysum;
unsigned char b60;
char dxfh, dyfh;
char x0, dx, dy;
lposi = 0;
k = 2;
while ((p - buf) <= length) {
b60 = * p & 0xc0;
switch (b60) {
case 0xc0:
if (k != 2) {
dotbuf = (k - lposi - 2) / 2;
dotbuf = 0;
lposi = k++;
k++;
}
x0 = ( * p & 0x3f) << 1;
dx = ( * (p + 1) >> 7) & 0x01;
dx = dx + x0;
p++;
dy = * p++ & 0x7f;
dotbuf = xsum = dx;
dotbuf = ysum = dy;
break;
case 0x80:
dxfh = dyfh = 1;
switch ( * p & 0x30) {
case 0x00:
if ( * p & 0x08)
dxfh = -1;
dx = * p & 0x07;
p++;
if ( * p & 0x80)
dyfh = -1;
dy = * p & 0x7f;
break;
case 0x10:
if ( * p & 0x08)
dyfh = -1;
dy = * p & 0x07;
p++;
if ( * p & 0x80)
dxfh = -1;
dx = * p & 0x7f;
break;
case 0x20:
case 0x30:
p++;
if ( * p & 0x80)
dxfh = -1;
dx = * p & 0x7f;
p++;
if ( * p & 0x80)
dyfh = -1;
dy = * p & 0x7f;
break;
}
p++;
xsum += dx * dxfh;
ysum += dy * dyfh;
dotbuf = xsum;
dotbuf = ysum;
break;
case 0x40:
dxfh = * p & 0x30;
if (dxfh == 0) {
dxfh = 1;
dyfh = 1;
} else if (dxfh == 0x10) {
dxfh = -1;
dyfh = 1;
} else if (dxfh == 0x20) {
dxfh = -1;
dyfh = -1;
} else if (dxfh == 0x30) {
dxfh = 1;
dyfh = -1;
}
count = * p++ & 0x0f;
for (i = 0; i < count; i++) {
dx = * p >> 4;
dy = * p & 0x0f;
xsum += dxfh * dx;
ysum += dyfh * dy;
dotbuf = xsum;
dotbuf = ysum;
p++;
}
break;
case 00:
count = * p++ & 0x3f;
for (i = 0; i < count; i++) {
if ( * p & 0x80)
dxfh = -1;
else
dxfh = 1;
if ( * p & 0x08)
dyfh = -1;
else
dyfh = 1;
dx = ( * p & 0x70) >> 4;
dy = ( * p & 0x07);
xsum += dx * dxfh;
ysum += dy * dyfh;
dotbuf = xsum;
dotbuf = ysum;
p++;
}
}
}
dotbuf = 0;
dotbuf = 0;
dotbuf = (k - lposi - 2 - 2) / 2;
dotbuf = 0;
return k;
}


-- edit by AlexZhang: code formatting
Floor 6 Posted 2005-10-18 10:57 ·  中国 广东 深圳 联通
初级用户
Credits 94
Posts 9
Joined 2005-07-17 17:37
20-year member
UID 40811
Status Offline
The routine under UCDOS uses its own special display function to complete it. In this way, this technology cannot be controlled. So I need to master this technology by myself. In order to avoid being at the mercy of others.

Thanks to Firstsail for providing the algorithm. I'll try it later after copying it down.
Floor 7 Posted 2005-10-18 11:29 ·  中国 广东 深圳 联通
初级用户
Credits 94
Posts 9
Joined 2005-07-17 17:37
20-year member
UID 40811
Status Offline
Then how can we display Chinese characters at high speed?? Please give your advice!!
Floor 8 Posted 2008-11-18 13:55 ·  中国 海南 联通
中级用户
★★
Credits 215
Posts 105
Joined 2007-06-02 22:33
19-year member
UID 90083
Gender Male
Status Offline
Thanks, already downloaded!
Forum Jump: