Method of displaying Chinese characters under DOS

zhaozj2021-02-11  180

Since there are still many friends who go to college, they may not show the way Chinese characters, now provide a way, but need a font, if necessary, give me email: behard@21cn.com.

Note: I am using BC3.1, which may be a bit different from the approach of TC.

#include #include #include #include #include #include #include # Include #include #include #include #include #include #include

#define box_color 13 # define flag_color 13 # Define Wave_color 5

#define LEFT_F_X 27 / * left pulse x * / # define RIGHT_F_X 255 / * right pusle x * / # define LEFT_P_X 508 / * left flow x * / # define RIGHT_P_X 736 / * right flow x * / # define PRN_MAX_X 956 # define PRN_MAX_Y 30 # Define PRN_X 220 # Define DX 20 # define DY 38 # define x_wid 16 # define y_WID 16

FILE * HZ16_HANDLE; INT getBIT_16 (Unsigned CHAR C, INT N); int Writec (int X, int y, int z, int color, unsigned char * p); Void Writef (int X, int y, int Width, int color , VA_LIST ARG_LIST, ...);

Main () {int drive = vga; int mode = vgahi; int 1;

HZ16_Handle = FOPEN ("hzk16.dot", "RB"); file: // red if (! hz16_handle) {printf ("cant't open this file"); return;}

// INITGRAPH (& Drive, & Mode, "E: // TC20"); Initgraph (& Drive, & Mode, "E: // BC31 // BGI"); Writef (100, 8, 44, black (lightgray << 4) "Show Chinese characters, Test English, Hello!"); Writec (100, 200, 40, black (LightGray << 4), "Show Chinese characters, Test English, Hello!"); // no English while (! Kbhit) ))); Closegraph ();

Void Writeft (VA_LIST Arg_List, ...) {INT I = 0; for (; i <32766; i ) {i ; i--;}}

void writef (int x, int y, int width, int color, va_list arg_list, ...) {va_list arg_ptr; char * format; unsigned char output [81]; unsigned char output_save, starti; struct textsettingstype ts; int counter, Len; unsigned char Temp; INT FC, BC, X1, Y1; INT DY, DX; Union Regs INREG, OUTREG; IF (Width> 78) Return; VA_Start (arg_ptr, arg_list); Format = (Char Far *) arg_list; vSprintf ((char *) OUTPUT, FORMAT, ARG_PTR); OUTPUT [Width] = 0; Fc = Color & 0x0f; BC = ((Color & 0xF0) >> 4); setFillStyle (1, bc); x1 = x Width * 8-1; y1 = y y_wid; bar (x, y, x1, y1); setTextStyle (0, 0, 1); dx = 8; DY = 4; counter = 0; do {IF ((Temp = OUTPUT [Counter])> (unsigned char) 0xA0) / * chinese * / {starti = counter; counter ; do {temp = output [counter]; counter ;} while (temp>); output_save = Output [- counter]; Output [counter] = 0; Writec (x, y, 0, color, & output [starti]); output [counter] = output_save; x = (counter-starti) * 8;} else (Output [counter] / * ascii * / {starti = counter; counter ; while (Output [ Counter] && output [counter "<(unsigned char) 0xA0) counter ; output_save = output [counter]; output [counter] = 0; setColor (FC); OutTextxy (x, y dy, (char *) Output Starti ); Output [counter] = output_save; x = (counter-starti) * dx;}} while (output [counter) && counter

Fcolor = color & 0x0f; bcolor = ((color & 0x0f0) >> 4); len = strlen (p); setfillstyle (1, bcolor); bar (x, y, x len * 8 (len / 2) * z, y 15); for (; i = * p; p ) {if (i & 0x80) {if (f == 0) {c1 = (char) i; f = 1;} else {C2 = (char) i; f = 0; if (C1 <0) {C1 = C1 97; C2 = C2 1; L = ((C1-1) * 94L C2) * 32; / * printf ("% D,% D, "," C1, C2); * / fseek (HZ16_Handle, L, Seek_set); FREAD (By, 32, 1, HZ16_Handle);} for (i1 = 0; I1 <16; i1 ) {for (i2 = 0; i2 <2; i2 ) {for (i3 = 0; i3 <8; i3 ) {ix (unsigned char) by [i1 * 2 i2], 7-i3) {PUTPIEL ( X I2 * 8 I3-1, Y I1-1, FCOLOR); / * Printf ("1"); * /}}}}} Return (x);} int Getbit_16 (unsigned char C, int N) {return ((c >> n) & 1);}

转载请注明原文地址:https://www.9cbs.com/read-4336.html

New Post(0)