--- rxvt-unicode/src/rxvtfont.C 2006/01/30 04:27:17 1.91 +++ rxvt-unicode/src/rxvtfont.C 2006/02/02 18:04:46 1.94 @@ -131,21 +131,22 @@ # endif #endif - // generic font fallback { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" }, - { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, - { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, - { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, + //{ CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, // this gem of a font has actual dotted circles within the combining character glyphs. #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:autohint=false" }, { CS_UNICODE, "xft:Arial Unicode MS:antialias=false:autohint=false" }, - // FreeMono is usually uglier than x fonts, so try last only. + // FreeMono is usually uglier than x fonts, so try after the others { CS_UNICODE, "xft:FreeMono:autohint=true" }, #endif + // generic font fallback, put this last, as many iso10646 fonts have extents + // specified for all glyphs in the range they cover, but most are simply empty + //{ CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, + //{ CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, { CS_UNKNOWN, 0 } }; @@ -159,7 +160,7 @@ #define NUM_EXTENT_TEST_CHARS (sizeof (extent_test_chars) / sizeof (extent_test_chars[0])) -#define dTermDisplay Display *disp = term->xdisp +#define dTermDisplay Display *disp = term->dpy #define dTermGC GC gc = term->gc ///////////////////////////////////////////////////////////////////////////// @@ -174,7 +175,7 @@ rxvt_drawable::operator XftDraw *() { if (!xftdrawable) - xftdrawable = XftDrawCreate (screen->xdisp, drawable, screen->visual, screen->cmap); + xftdrawable = XftDrawCreate (screen->dpy, drawable, screen->visual, screen->cmap); return xftdrawable; } @@ -515,7 +516,7 @@ unsigned long value; if (XGetFontProperty (f, property, &value)) - return XGetAtomName (term->xdisp, value); + return XGetAtomName (term->dpy, value); else return rxvt_strdup (repl); } @@ -548,7 +549,7 @@ unsigned long height; #if 0 - if (!XGetFontProperty (f, XInternAtom (term->xdisp, "PIXEL_SIZE", 0), &height)) + if (!XGetFontProperty (f, XInternAtom (term->dpy, "PIXEL_SIZE", 0), &height)) return false; #else height = f->ascent + f->descent; @@ -863,7 +864,8 @@ int dir_ret, asc_ret, des_ret; XTextExtents16 (f, &ch, 1, &dir_ret, &asc_ret, &des_ret, &g); - int wcw = WCWIDTH (*t); if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; + int wcw = WCWIDTH (*t); + if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; if (width < g.width) width = g.width; } @@ -892,7 +894,7 @@ { if (f) { - XFreeFont (term->xdisp, f); + XFreeFont (term->dpy, f); f = 0; } } @@ -947,7 +949,7 @@ // check wether character overlaps previous/next character int w = xcs->rbearing - xcs->lbearing; - int wcw = WCWIDTH (unicode); + int wcw = max (WCWIDTH (unicode), 1); careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw; @@ -1074,7 +1076,7 @@ { if (f) { - XftFontClose (term->xdisp, f); + XftFontClose (term->dpy, f); f = 0; } } @@ -1251,7 +1253,7 @@ { careful = false; - if (!XftCharExists (term->xdisp, f, unicode)) + if (!XftCharExists (term->dpy, f, unicode)) return false; if (!prop || prop->width == rxvt_fontprop::unset) @@ -1260,10 +1262,10 @@ // check character against base font bounding box FcChar32 ch = unicode; XGlyphInfo g; - XftTextExtents32 (term->xdisp, f, &ch, 1, &g); + XftTextExtents32 (term->dpy, f, &ch, 1, &g); int w = g.width - g.x; - int wcw = WCWIDTH (unicode); + int wcw = max (WCWIDTH (unicode), 1); careful = g.x > 0 || w > prop->width * wcw; @@ -1308,7 +1310,6 @@ FT_UInt glyph = XftCharIndex (disp, f, fc); XftGlyphExtents (disp, f, &glyph, 1, &extents); - ep->glyph = glyph; ep->x = x + (cwidth - extents.xOff >> 1); ep->y = y + ascent; @@ -1577,7 +1578,7 @@ //FcPatternAddBool (p, FC_ANTIALIAS, 1); XftResult result; - FcPattern *match = XftFontMatch (term->xdisp, term->display->screen, p, &result); + FcPattern *match = XftFontMatch (term->dpy, term->display->screen, p, &result); FcPatternDestroy (p);