--- rxvt-unicode/src/defaultfont.C 2004/03/03 23:06:58 1.30 +++ rxvt-unicode/src/defaultfont.C 2004/03/15 00:08:11 1.40 @@ -270,13 +270,16 @@ width = 1; height = 1; ascent = 1; descent = 0; + set_name ("built-in pseudofont"); + return true; } - bool has_codepoint (uint32_t unicode) + bool has_codepoint (unicode_t unicode) { if (unicode <= 0x001f) return true; + if (unicode >= 0x0080 && unicode <= 0x009f) return true; @@ -284,6 +287,9 @@ && linedraw_cmds[unicode - 0x2500]) return true; + if (IS_COMPOSE (unicode)) + return true; + switch (unicode) { case ZERO_WIDTH_CHAR: @@ -309,6 +315,9 @@ while (len--) { +#if ENABLE_COMBINING + compose_char *cc; +#endif text_t t = *text++; // is it in our linedrawing table? @@ -316,8 +325,8 @@ { const char *p = linedraw_cmds[t - 0x2500]; - int x0 = x, x1 = x + r->TermWin.fwidth / 2, x2 = x + r->TermWin.fwidth - 1; - int y0 = y, y1 = y + r->TermWin.fheight / 2, y2 = y + r->TermWin.fheight - 1; + 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; @@ -347,6 +356,22 @@ gcv.line_width = 0; XChangeGC (d.display->display, GC, GCLineWidth, &gcv); } +#if ENABLE_COMBINING + else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) + { + rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)]; + f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg); + if (cc->c2 != NOCHAR) + { + // prefer font of first character, for no good reasons + rxvt_font *f2 = f1->has_codepoint (cc->c2) + ? f1 + : (*fs)[fs->find_font (cc->c2)]; + + f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1); + } + } +#endif else switch (t) { @@ -381,7 +406,7 @@ bool load (const rxvt_fontprop &prop); - bool has_codepoint (uint32_t unicode); + bool has_codepoint (unicode_t unicode); void draw (rxvt_drawable &d, int x, int y, const text_t *text, int len, @@ -638,7 +663,7 @@ } bool -rxvt_font_x11::has_codepoint (uint32_t unicode) +rxvt_font_x11::has_codepoint (unicode_t unicode) { uint32_t ch = FROM_UNICODE (cs, unicode); @@ -790,7 +815,7 @@ const text_t *text, int len, int fg, int bg); - bool has_codepoint (uint32_t unicode); + bool has_codepoint (unicode_t unicode); protected: XftFont *f; @@ -913,7 +938,7 @@ } bool -rxvt_font_xft::has_codepoint (uint32_t unicode) +rxvt_font_xft::has_codepoint (unicode_t unicode) { return XftCharExists (DISPLAY, f, unicode); } @@ -1019,6 +1044,7 @@ else f = new rxvt_font_x11; + f->fs = this; f->set_term (r); f->set_name (strdup (name)); @@ -1125,7 +1151,7 @@ } int -rxvt_fontset::find_font (uint32_t unicode) +rxvt_fontset::find_font (unicode_t unicode) { for (unsigned int i = 0; i < fonts.size (); i++) {