--- rxvt-unicode/src/rxvtfont.C 2005/12/06 15:41:26 1.74 +++ rxvt-unicode/src/rxvtfont.C 2006/01/04 20:43:38 1.77 @@ -21,6 +21,7 @@ #include "../config.h" #include "rxvt.h" +#include "rxvtlib.h" #include "rxvtutil.h" #include "rxvtfont.h" @@ -29,7 +30,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 +279,7 @@ rxvt_fontprop p; p.width = p.height = 1; + p.ascent = rxvt_fontprop::unset; p.weight = rxvt_fontprop::medium; p.slant = rxvt_fontprop::roman; @@ -307,7 +309,8 @@ if (unicode <= 0x009f) return true; - if (unicode >= 0x2500 && unicode <= 0x259f) + if (unicode >= 0x2500 && unicode <= 0x259f && + ! OPTION_R (Opt_skipBuiltinGlyphs)) return true; if (IS_COMPOSE (unicode)) @@ -335,7 +338,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,16 +354,17 @@ ; int width = text - tp; - int fwidth = r->TermWin.fwidth * width; + int fwidth = r->fwidth * width; - if (0x2500 <= t && t <= 0x259f) + if (0x2500 <= t && t <= 0x259f && + ! OPTION_R (Opt_skipBuiltinGlyphs)) { uint16_t offs = linedraw_offs[t - 0x2500]; uint32_t *a = linedraw_command + (offs >> 4); 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 +470,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 +529,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 +560,8 @@ free (weight); free (slant); + p.ascent = f->ascent; + return true; } @@ -958,10 +965,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 +986,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 +997,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 +1018,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 +1029,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 +1082,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 +1272,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 +1283,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 +1346,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 +1529,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)