diff -u -r hanterm304beta5/charproc.c hanterm/charproc.c --- hanterm304beta5/charproc.c Thu Feb 5 09:55:43 1998 +++ hanterm/charproc.c Thu Feb 5 15:41:03 1998 @@ -119,6 +119,10 @@ extern int convert_3_to_utf8(); #endif +#if !defined(NO_PATCH_LINE_DRAW) +void set_vt_graphics (/*TScreen *screen*/); +#endif + static void VTallocbuf(); static int finput(); static void dotext(); @@ -1643,9 +1647,18 @@ break; case '0': /* special graphics (line drawing) */ +#if !defined(NO_PATCH_LINE_DRAW) + { + extern int *gr_mapping; + for (s=buf; s=0x5f && *s<=0x7e) *s = *s == 0x5f ? 0x7f : *s - 0x5f; +#endif break; default: /* any character sets we don't recognize*/ @@ -3679,6 +3692,9 @@ Redraw (); } set_vt_box (screen); +#if !defined(NO_PATCH_LINE_DRAW) + set_vt_graphics(screen); +#endif } set_vt_box (screen) @@ -3702,6 +3718,138 @@ screen->hbox = hVTbox; } +#if !defined(NO_PATCH_LINE_DRAW) +Pixmap vtgraphics[20]={0}; /* Bitmaps */ +int *gr_mapping = NULL; +void +set_vt_graphics (screen) + TScreen *screen; +{ + static GC bmgc=0; + static Pixmap gray=0; + XPoint pts[4]; + Display *dpy = screen->display; + Window win = RootWindowOfScreen(XtScreen(term)); + int W = FontWidth(screen), H = FontHeight(screen); + int w = W - 1, h = H - 1; + int w2 = w/2, h2 = h/2; + int i; + char gr_valid_code[] = " `ajklmnopqrstuvwx~"; + + if (!gr_mapping) { + gr_mapping = (int *)malloc(sizeof(int)*256); + for(i = 0; i < 256; i++) { + gr_mapping[i] = 1; + } + for(i=0;gr_valid_code[i];i++) { + gr_mapping[gr_valid_code[i]] = i + 1; + } + } + + if (!gray) { + /* + static char gray_bits[] = { 0x08, 0x02, 0x04, 0x01 }; + gray = XCreateBitmapFromData(dpy, win, gray_bits, 4, 4); + */ + static char gray_bits[] = { 0x11, 0x44 }; + gray = XCreateBitmapFromData(dpy, win, gray_bits, 8, 2); + } + if (!bmgc) { + bmgc = XCreateGC(dpy, gray, 0, NULL); + } + + for (i = 1; i < 20; i ++) { + if (vtgraphics[i]) { + XFreePixmap(dpy, vtgraphics[i]); + vtgraphics[i] = 0; + } + } + + vtgraphics[gr_mapping[' ']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['`']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['a']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['j']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['k']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['l']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['m']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['n']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['o']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['p']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['q']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['r']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['s']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['t']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['u']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['v']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['w']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['x']] = XCreatePixmap(dpy, win, W, H, 1); + vtgraphics[gr_mapping['~']] = XCreatePixmap(dpy, win, W, H, 1); + + XSetForeground(dpy, bmgc, 0); + XSetFillStyle(dpy, bmgc, FillSolid); + for (i = 1; i < 20; i ++) { + if (vtgraphics[i]) { + XFillRectangle(dpy, vtgraphics[i], bmgc, 0, 0, W, H); + } + } + + XSetForeground(dpy, bmgc, 1); + + pts[0].x = w2; pts[0].y = 0; + pts[1].x = 0; pts[1].y = h2; + pts[2].x = w2; pts[2].y = h2*2; + pts[3].x = w2*2; pts[3].y = h2; + XFillPolygon(dpy, vtgraphics[gr_mapping['`']], bmgc, pts, 4, Nonconvex, CoordModeOrigin); + + XSetFillStyle(dpy, bmgc, FillStippled); + XSetStipple(dpy, bmgc, gray); + XFillRectangle(dpy, vtgraphics[gr_mapping['a']], bmgc, 0, 0, W, H); + + XSetFillStyle(dpy, bmgc, FillSolid); + XDrawLine(dpy, vtgraphics[gr_mapping['j']], bmgc, 0, h2, w2, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['j']], bmgc, w2, 0, w2, h2); + + XDrawLine(dpy, vtgraphics[gr_mapping['k']], bmgc, 0, h2, w2, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['k']], bmgc, w2, h2, w2, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['l']], bmgc, w2, h2, w, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['l']], bmgc, w2, h2, w2, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['m']], bmgc, w2, h2, w, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['m']], bmgc, w2, 0, w2, h2); + + XDrawLine(dpy, vtgraphics[gr_mapping['n']], bmgc, 0, h2, w, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['n']], bmgc, w2, 0, w2, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['o']], bmgc, 0, 0, w, 0); + + XDrawLine(dpy, vtgraphics[gr_mapping['p']], bmgc, 0, h/4, w, h/4); + + XDrawLine(dpy, vtgraphics[gr_mapping['q']], bmgc, 0, h2, w, h2); + + XDrawLine(dpy, vtgraphics[gr_mapping['r']], bmgc, 0, h*3/4, w, h*3/4); + + XDrawLine(dpy, vtgraphics[gr_mapping['s']], bmgc, 0, h, w, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['t']], bmgc, w2, h2, w, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['t']], bmgc, w2, 0, w2, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['u']], bmgc, 0, h2, w2, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['u']], bmgc, w2, 0, w2, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['v']], bmgc, 0, h2, w, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['v']], bmgc, w2, 0, w2, h2); + + XDrawLine(dpy, vtgraphics[gr_mapping['w']], bmgc, 0, h2, w, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['w']], bmgc, w2, h2, w2, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['x']], bmgc, w2, 0, w2, h); + + XDrawLine(dpy, vtgraphics[gr_mapping['~']], bmgc, w2-1, h2, w2+1, h2); + XDrawLine(dpy, vtgraphics[gr_mapping['~']], bmgc, w2, h2-1, w2, h2+1); + +} +#endif set_cursor_gcs (screen) TScreen *screen; diff -u -r hanterm304beta5/hangul.c hanterm/hangul.c --- hanterm304beta5/hangul.c Thu Feb 5 10:02:27 1998 +++ hanterm/hangul.c Thu Feb 5 15:46:50 1998 @@ -441,6 +441,18 @@ #endif } else { +#if !defined(NO_PATCH_LINE_DRAW) + p = str; + if (*p && ((unsigned char)*p) < 20) { + extern Pixmap vtgraphics[]; /* Bitmaps */ + XCopyPlane(d, vtgraphics[*p], w, gc, 0, 0, + FontWidth(screen), FontHeight(screen), + x, y - screen->ascent, 1); + p++; + len--; + width = FontWidth(screen); + } else { +#endif for (p = str; len > 0 && !(*p & 0x80); p++, len--) ; XDrawImageString(d, w, gc, x, y, str, p - str); @@ -460,6 +472,9 @@ screen->descent - screen->fnt_norm->descent); } +#if !defined(NO_PATCH_LINE_DRAW) + } +#endif } x += width; str = p; @@ -489,9 +504,20 @@ XDrawString16(d, w, hgc, x, y, buf, n); } else { +#if !defined(NO_PATCH_LINE_DRAW) + p = str; + if (*p && ((unsigned char)*p) < 20) { + /* skip */ + p++; + len--; + } else { +#endif for (p = str; len > 0 && !(*p & 0x80); p++, len--) ; XDrawString(d, w, gc, x, y, str, p - str); +#if !defined(NO_PATCH_LINE_DRAW) + } +#endif } width = (p - str) * FontWidth(screen); x += width;