--- rxvt-unicode/src/rxvtfont.C 2005/12/06 15:41:26 1.74 +++ rxvt-unicode/src/rxvtfont.C 2006/01/03 23:40:58 1.76 @@ -29,7 +29,7 @@ #include #define DISPLAY r->display->display -#define TGC r->TermWin.gc +#define TGC r->gc #define MAX_OVERLAP (4 + 1) // max. character width in 4ths of the base width @@ -278,6 +278,7 @@ rxvt_fontprop p; p.width = p.height = 1; + p.ascent = rxvt_fontprop::unset; p.weight = rxvt_fontprop::medium; p.slant = rxvt_fontprop::roman; @@ -335,7 +336,7 @@ { Display *disp = d.display->display; - clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); + clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); XSetForeground (disp, TGC, r->pix_colors[fg]); @@ -351,7 +352,7 @@ ; int width = text - tp; - int fwidth = r->TermWin.fwidth * width; + int fwidth = r->fwidth * width; if (0x2500 <= t && t <= 0x259f) { @@ -360,7 +361,7 @@ uint32_t *b = a + (offs & 15); int W = fwidth; - int H = r->TermWin.fheight; + int H = r->fheight; int x_[16]; int y_[16]; @@ -466,7 +467,7 @@ default: XDrawRectangle (disp, d, TGC, x + 2, y + 2, - fwidth - 4, r->TermWin.fheight - 4); + fwidth - 4, r->fheight - 4); } x += fwidth; @@ -525,6 +526,7 @@ { p.width = avgwidth ? (avgwidth + 1) / 10 : (height + 1) / 2; p.height = height; + p.ascent = rxvt_fontprop::unset; p.weight = *weight == 'B' || *weight == 'b' ? rxvt_fontprop::bold : rxvt_fontprop::medium; p.slant = *slant == 'r' || *slant == 'R' ? rxvt_fontprop::roman : rxvt_fontprop::italic; @@ -555,6 +557,8 @@ free (weight); free (slant); + p.ascent = f->ascent; + return true; } @@ -958,10 +962,10 @@ // but the result still isn't perfect /. bool slow = this->slow - || width != r->TermWin.fwidth - || height != r->TermWin.fheight; + || width != r->fwidth + || height != r->fheight; - int base = ascent; // sorry, incorrect: r->TermWin.fbase; + int base = ascent; // sorry, incorrect: r->fbase; XGCValues v; v.foreground = r->pix_colors[fg]; @@ -979,7 +983,7 @@ } else { - clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); + clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); XChangeGC (d.display->display, TGC, GCForeground | GCFont, &v); @@ -990,7 +994,7 @@ if (xc->byte1 || xc->byte2) XDrawString16 (d.display->display, d, TGC, x, y + base, xc, 1); - x += r->TermWin.fwidth; + x += r->fwidth; xc++; len--; } while (len); @@ -1011,7 +1015,7 @@ } else { - clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); + clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); XChangeGC (d.display->display, TGC, GCForeground | GCFont, &v); @@ -1022,7 +1026,7 @@ if (*xc) XDrawString (d.display->display, d, TGC, x, y + base, xc, 1); - x += r->TermWin.fwidth; + x += r->fwidth; xc++; len--; } while (len); @@ -1075,6 +1079,7 @@ p.width = width; p.height = height; + p.ascent = ascent; p.weight = face->style_flags & FT_STYLE_FLAG_BOLD ? rxvt_fontprop::bold : rxvt_fontprop::medium; p.slant = face->style_flags & FT_STYLE_FLAG_ITALIC @@ -1264,7 +1269,7 @@ const text_t *text, int len, int fg, int bg) { - clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); + clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); int base = ascent; // should be fbase, but that is incorrect @@ -1275,11 +1280,11 @@ while (len) { - int cwidth = r->TermWin.fwidth; + int cwidth = r->fwidth; FcChar32 fc = *text++; len--; while (len && *text == NOCHAR) - text++, len--, cwidth += r->TermWin.fwidth; + text++, len--, cwidth += r->fwidth; if (fc == ' ' && ep == enc) // skip leading spaces x += cwidth; @@ -1338,7 +1343,7 @@ void rxvt_fontset::clear () { - prop.width = prop.height = prop.weight = prop.slant + prop.width = prop.height = prop.ascent = prop.weight = prop.slant = rxvt_fontprop::unset; for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) @@ -1521,6 +1526,9 @@ if (!realize_font (i)) goto next_font; + + if (prop.ascent != rxvt_fontprop::unset) + max_it (f->ascent, prop.ascent); } if (f->cs == CS_UNKNOWN)