--- rxvt-unicode/src/rxvtfont.C 2006/01/03 23:40:58 1.76 +++ rxvt-unicode/src/rxvtfont.C 2006/01/09 07:35:23 1.83 @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: rxvtfont.C *----------------------------------------------------------------------* - * Copyright (c) 2003-2004 Marc Lehmann + * Copyright (c) 2003-2006 Marc Lehmann * - original version. * * This program is free software; you can redistribute it and/or modify @@ -21,6 +21,7 @@ #include "../config.h" #include "rxvt.h" +#include "rxvtlib.h" #include "rxvtutil.h" #include "rxvtfont.h" @@ -308,7 +309,8 @@ if (unicode <= 0x009f) return true; - if (unicode >= 0x2500 && unicode <= 0x259f) + if (unicode >= 0x2500 && unicode <= 0x259f && + !r->option (Opt_skipBuiltinGlyphs)) return true; if (IS_COMPOSE (unicode)) @@ -1269,14 +1271,15 @@ const text_t *text, int len, int fg, int bg) { - clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); + XGlyphInfo extents; + XftGlyphSpec *enc = (XftGlyphSpec *)get_enc_buf (len * sizeof (XftGlyphSpec)); + XftGlyphSpec *ep = enc; - int base = ascent; // should be fbase, but that is incorrect + clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); - XGlyphInfo extents; - FcChar32 *enc = (FcChar32 *) get_enc_buf (len * sizeof (FcChar32)); - FcChar32 *ep = enc; - int ewidth = 0; + // cut trailing spaces + while (len && text [len - 1] == ' ') + len--; while (len) { @@ -1286,44 +1289,22 @@ while (len && *text == NOCHAR) text++, len--, cwidth += r->fwidth; - if (fc == ' ' && ep == enc) // skip leading spaces - x += cwidth; - else + if (fc != ' ') // skip spaces { - FT_UInt gl = XftCharIndex (d.display->display, f, fc); - XftGlyphExtents (d.display->display, f, &gl, 1, &extents); - - if (extents.xOff != cwidth) - { - if (ewidth) - { - XftDrawGlyphs (d, &r->pix_colors[fg].c, f, - x, y + base, enc, ep - enc); - x += ewidth; + FT_UInt glyph = XftCharIndex (d.display->display, f, fc); + XftGlyphExtents (d.display->display, f, &glyph, 1, &extents); - ep = enc; - ewidth = 0; - } - - if (extents.xOff > cwidth) - extents.xOff = cwidth; - - XftDrawGlyphs (d, &r->pix_colors[fg].c, f, - x + (cwidth - extents.xOff >> 1), - y + base, &gl, 1); - x += cwidth; - } - else - { - *ep++ = gl; - ewidth += cwidth; - } + ep->glyph = glyph; + ep->x = x + (cwidth - extents.xOff >> 1); + ep->y = y + ascent; + ep++; } + + x += cwidth; } if (ep != enc) - XftDrawGlyphs (d, &r->pix_colors[fg].c, f, - x, y + base, enc, ep - enc); + XftDrawGlyphSpec (d, &r->pix_colors[fg].c, f, enc, ep - enc); } #endif