--- rxvt-unicode/src/defaultfont.C 2004/02/24 00:44:23 1.24 +++ rxvt-unicode/src/defaultfont.C 2004/03/05 04:43:41 1.36 @@ -74,15 +74,18 @@ { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" }, { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" }, # endif - { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, - { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, - { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, - { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, - { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, - { CS_CNS11643_1992_5, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-5" }, - { CS_CNS11643_1992_6, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-6" }, - { CS_CNS11643_1992_7, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-7" }, - { CS_CNS11643_1992_F, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-f" }, + { CS_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" }, + { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" }, + { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" }, + { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, + { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, + { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, + { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, + { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, + { CS_CNS11643_1992_5, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-5" }, + { CS_CNS11643_1992_6, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-6" }, + { CS_CNS11643_1992_7, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-7" }, + { CS_CNS11643_1992_F, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-f" }, #endif #if XFT @@ -95,11 +98,16 @@ { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, +#if UNICODE_3 && XFT + { CS_UNICODE, "xft:Code2001" }, // contains many plane-1 characters +#endif + { CS_UNKNOWN, 0 } }; ///////////////////////////////////////////////////////////////////////////// +#if XFT rxvt_drawable::~rxvt_drawable () { if (xftdrawable) @@ -113,6 +121,7 @@ return xftdrawable; } +#endif ///////////////////////////////////////////////////////////////////////////// @@ -268,6 +277,7 @@ { if (unicode <= 0x001f) return true; + if (unicode >= 0x0080 && unicode <= 0x009f) return true; @@ -275,6 +285,9 @@ && linedraw_cmds[unicode - 0x2500]) return true; + if (IS_COMPOSE (unicode)) + return true; + switch (unicode) { case ZERO_WIDTH_CHAR: @@ -300,14 +313,16 @@ while (len--) { + compose_char *cc; text_t t = *text++; + // is it in our linedrawing table? if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) { const char *p = linedraw_cmds[t - 0x2500]; - int x0 = x, x1 = x + r->TermWin.fwidth / 2, x2 = x + r->TermWin.fwidth ; - int y0 = y, y1 = y + r->TermWin.fheight / 2, y2 = y + r->TermWin.fheight; + int x0 = x, x1 = x + (r->TermWin.fwidth - 1) / 2, x2 = x + r->TermWin.fwidth - 1; + int y0 = y, y1 = y + (r->TermWin.fheight - 1) / 2, y2 = y + r->TermWin.fheight - 1; XGCValues gcv; @@ -337,14 +352,29 @@ gcv.line_width = 0; XChangeGC (d.display->display, GC, GCLineWidth, &gcv); } + else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) + { + (*fs)[fs->find_font (cc->c1)]->draw (d, x, y, &(t = cc->c1), 1, fg, bg); + if (cc->c2 != NOCHAR) + (*fs)[fs->find_font (cc->c2)]->draw (d, x, y, &(t = cc->c2), 1, fg, -1); + } else - switch (*text++) + switch (t) { - case NOCHAR: case ZERO_WIDTH_CHAR: break; default: - XDrawRectangle (d.display->display, d, GC, x + 2, y + 2, r->TermWin.fwidth - 5, r->TermWin.fheight - 5); + int w = 0; + while (len > 0 && *text == NOCHAR) + { + ++text; + --len; + w += r->TermWin.fwidth; + } + + XDrawRectangle (d.display->display, d, GC, x + 2, y + 2, + w + r->TermWin.fwidth - 5, r->TermWin.fheight - 5); + x += w; } x += r->TermWin.fwidth; @@ -429,7 +459,7 @@ rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) { int slashes = 0; - const char *comp[12]; + const char *comp[13]; for (const char *c = name; *c; c++) if (*c == '-') @@ -1000,6 +1030,7 @@ else f = new rxvt_font_x11; + f->fs = this; f->set_term (r); f->set_name (strdup (name));