--- rxvt-unicode/src/defaultfont.C 2004/03/16 05:51:36 1.45 +++ rxvt-unicode/src/defaultfont.C 2004/03/28 02:07:08 1.50 @@ -232,11 +232,13 @@ if (unicode <= 0x001f) return true; - if (unicode >= 0x0080 && unicode <= 0x009f) + if (unicode <= 0x007f) + return false; + + if (unicode <= 0x009f) return true; - if (unicode >= 0x2500 && unicode <= 0x259f - && linedraw_offs[unicode - 0x2500] & 15) + if (unicode >= 0x2500 && unicode <= 0x259f) return true; if (IS_COMPOSE (unicode)) @@ -261,7 +263,6 @@ const text_t *text, int len, int fg, int bg) { -return; clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); XSetForeground (d.display->display, TGC, r->PixColors[fg]); @@ -273,18 +274,15 @@ #endif text_t t = *text++; - int W = r->TermWin.fwidth , w = (W - 1) / 2; - int H = r->TermWin.fheight, h = (H - 1) / 2; - int x0 = x, x1 = x + w, x2 = x + r->TermWin.fwidth ; - int y0 = y, y1 = y + h, y2 = y + r->TermWin.fheight; - - if (0x2500 <= t && t <= 0x259f - && linedraw_offs[t - 0x2500] & 15) + if (0x2500 <= t && t <= 0x259f) { uint16_t offs = linedraw_offs[t - 0x2500]; uint32_t *a = linedraw_command + (offs >> 4); uint32_t *b = a + (offs & 15); + int W = r->TermWin.fwidth; + int H = r->TermWin.fheight; + int x_[16]; int y_[16]; @@ -336,7 +334,6 @@ &gcv); } - XFillRectangle (d.display->display, d, TGC, x1, y1, x2 - x1 + 1, y2 - y1 + 1); if (a) @@ -346,7 +343,6 @@ gcv.fill_style = FillSolid; XChangeGC (d.display->display, TGC, GCFillStyle, &gcv); } - break; case 2: // arc XDrawArc (d.display->display, d, TGC, @@ -417,13 +413,13 @@ codeset cs; bool enc2b, encm; - const char *get_property (XFontStruct *f, const char *property, const char *repl) const; + char *get_property (XFontStruct *f, const char *property, const char *repl) const; bool set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth); bool set_properties (rxvt_fontprop &p, XFontStruct *f); bool set_properties (rxvt_fontprop &p, const char *name); }; -const char * +char * rxvt_font_x11::get_property (XFontStruct *f, const char *property, const char *repl) const { unsigned long value; @@ -431,7 +427,7 @@ if (XGetFontProperty (f, XInternAtom (DISPLAY, property, 0), &value)) return XGetAtomName (DISPLAY, value); else - return repl; + return rxvt_strdup (repl); } rxvt_fontprop @@ -456,9 +452,6 @@ bool rxvt_font_x11::set_properties (rxvt_fontprop &p, XFontStruct *f) { - const char *weight = get_property (f, "WEIGHT_NAME", "medium"); - const char *slant = get_property (f, "SLANT", "r"); - unsigned long height; if (!XGetFontProperty (f, XInternAtom (DISPLAY, "PIXEL_SIZE", 0), &height)) return false; @@ -467,7 +460,15 @@ if (!XGetFontProperty (f, XInternAtom (DISPLAY, "AVERAGE_WIDTH", 0), &avgwidth)) avgwidth = 0; - return set_properties (p, height, weight, slant, avgwidth); + char *weight = get_property (f, "WEIGHT_NAME", "medium"); + char *slant = get_property (f, "SLANT", "r"); + + set_properties (p, height, weight, slant, avgwidth); + + free (weight); + free (slant); + + return true; } bool @@ -581,8 +582,8 @@ if (!f) return false; - const char *registry = get_property (f, "CHARSET_REGISTRY", 0); - const char *encoding = get_property (f, "CHARSET_ENCODING", 0); + char *registry = get_property (f, "CHARSET_REGISTRY", 0); + char *encoding = get_property (f, "CHARSET_ENCODING", 0); if (registry && encoding) { @@ -606,6 +607,9 @@ cs = codeset_from_name (charset); } + free (registry); + free (encoding); + if (cs == CS_UNICODE) cs = CS_UNICODE_16; // X11 can have a max. of 65536 chars per font @@ -727,7 +731,6 @@ XGCValues v; v.foreground = r->PixColors[fg]; - v.background = r->PixColors[bg]; v.font = f->fid; if (enc2b) @@ -736,6 +739,7 @@ if (bg == Color_bg && !slow) { + v.background = r->PixColors[bg]; XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); XDrawImageString16 (d.display->display, d, TGC, x, y + base, xc, len); } @@ -767,6 +771,7 @@ if (bg == Color_bg && !slow) { + v.background = r->PixColors[bg]; XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); XDrawImageString (d.display->display, d, TGC, x, y + base, xc, len); } @@ -1154,7 +1159,9 @@ int rxvt_fontset::find_font (unicode_t unicode) { - for (unsigned int i = 0; i < fonts.size (); i++) + for (unsigned int i = !!(0x20 <= unicode && unicode <= 0x7f); // skip pseudo-font for ascii + i < fonts.size (); + i++) { rxvt_font *f = fonts[i];