--- rxvt-unicode/src/defaultfont.C 2004/03/16 11:07:44 1.48 +++ rxvt-unicode/src/defaultfont.C 2004/03/28 02:07:08 1.50 @@ -413,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; @@ -427,7 +427,7 @@ if (XGetFontProperty (f, XInternAtom (DISPLAY, property, 0), &value)) return XGetAtomName (DISPLAY, value); else - return repl; + return rxvt_strdup (repl); } rxvt_fontprop @@ -452,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; @@ -463,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 @@ -577,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) { @@ -602,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 @@ -723,7 +731,6 @@ XGCValues v; v.foreground = r->PixColors[fg]; - v.background = r->PixColors[bg]; v.font = f->fid; if (enc2b) @@ -732,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); } @@ -763,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); }