--- rxvt-unicode/src/rxvtfont.C 2005/02/12 18:55:04 1.67 +++ rxvt-unicode/src/rxvtfont.C 2005/06/18 10:02:35 1.71 @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *---------------------------------------------------------------------*/ #include "../config.h" @@ -132,10 +132,10 @@ { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, #if XFT - { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false:autohint=true"}, - { CS_UNICODE, "xft:Courier New:antialias=false:autohint=true" }, - { CS_UNICODE, "xft:Andale Mono:antialias=false" }, - { CS_UNICODE, "xft:Arial Unicode MS:antialias=false" }, + { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false:autohint=true" }, + { CS_UNICODE, "xft:Courier New:antialias=false:autohint=true" }, + { CS_UNICODE, "xft:Andale Mono:antialias=false:autohint=false" }, + { CS_UNICODE, "xft:Arial Unicode MS:antialias=false:autohint=false" }, // FreeMono is usually uglier than x fonts, so try last only. { CS_UNICODE, "xft:FreeMono:autohint=true" }, @@ -718,6 +718,8 @@ if (replace_field (fname, list[i], 6, '0', field_str)) diff += 10; // slightly penalize scalable fonts + else if (replace_field (fname, list[i], 11, '0', "0")) + diff += 300; // more heavily penalize what looks like scaled bitmap fotns if (!set_properties (p, fname)) continue; @@ -743,7 +745,7 @@ font_weight *best = fonts + count - 1; for (font_weight *w = best; w-- > fonts; ) - if (w->diff < best->diff) + if (w->diff <= best->diff) best = w; if (!best->name @@ -1098,7 +1100,7 @@ FcValue v; if (prop.height != rxvt_fontprop::unset - || (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch + && (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch && FcPatternGet (p, FC_SIZE, 0, &v) != FcResultMatch)) FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height); @@ -1254,54 +1256,53 @@ FcChar32 *enc = (FcChar32 *) get_enc_buf (len * sizeof (FcChar32)); FcChar32 *ep = enc; int ewidth = 0; - int xoff = 0; while (len) { int cwidth = r->TermWin.fwidth; FcChar32 fc = *text++; len--; - FT_UInt gl; while (len && *text == NOCHAR) text++, len--, cwidth += r->TermWin.fwidth; - gl = XftCharIndex (d.display->display, f, fc); - XftGlyphExtents (d.display->display, f, &gl, 1, &extents); - - if (extents.xOff != cwidth && ep != enc) - { - if (xoff > ewidth) xoff = ewidth; - XftDrawGlyphs (d, &r->pix_colors[fg].c, f, - x + (ewidth - xoff >> 1), - y + base, enc, ep - enc); - x += ewidth; - - ep = enc; - ewidth = 0; - xoff = 0; - } - if (fc == ' ' && ep == enc) // skip leading spaces - { - x += cwidth; - continue; - } - + x += cwidth; else { - *ep++ = gl; - ewidth += cwidth; - xoff += extents.xOff; + 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; + + 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; + } } } if (ep != enc) - { - if (xoff > ewidth) xoff = ewidth; - XftDrawGlyphs (d, &r->pix_colors[fg].c, f, - x + (ewidth - xoff >> 1), - y + base, enc, ep - enc); - } + XftDrawGlyphs (d, &r->pix_colors[fg].c, f, + x, y + base, enc, ep - enc); } #endif