--- rxvt-unicode/src/defaultfont.C 2003/12/26 08:18:45 1.13 +++ rxvt-unicode/src/defaultfont.C 2004/02/20 22:27:23 1.20 @@ -25,7 +25,7 @@ #include -#define DISPLAY r->Xdisplay +#define DISPLAY r->display->display #define DRAWABLE r->TermWin.vt #define GC r->TermWin.gc @@ -75,14 +75,15 @@ { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" }, { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" }, # endif - { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-1" }, - { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-2" }, - { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-3" }, - { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-4" }, - { CS_CNS11643_1992_5, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-5" }, - { CS_CNS11643_1992_6, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-6" }, - { CS_CNS11643_1992_7, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-7" }, - { CS_CNS11643_1992_F, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643.1992-f" }, + { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, + { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, + { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, + { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, + { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, + { CS_CNS11643_1992_5, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-5" }, + { CS_CNS11643_1992_6, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-6" }, + { CS_CNS11643_1992_7, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-7" }, + { CS_CNS11643_1992_F, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-f" }, #endif #if XFT @@ -104,7 +105,7 @@ static uint32_t enc_len; static inline void * -get_enc_buf (int len) +get_enc_buf (uint32_t len) { if (len > enc_len) { @@ -116,7 +117,7 @@ } static const char * -enc_char (const text_t *text, int len, codeset cs, bool &zero) +enc_char (const text_t *text, uint32_t len, codeset cs, bool &zero) { uint8_t *buf = (uint8_t *)get_enc_buf (len); @@ -137,7 +138,7 @@ } static const XChar2b * -enc_xchar2b (const text_t *text, int len, codeset cs, bool &zero) +enc_xchar2b (const text_t *text, uint32_t len, codeset cs, bool &zero) { XChar2b *buf = (XChar2b *)get_enc_buf (len * sizeof (XChar2b)); @@ -429,7 +430,7 @@ if (f) { - // the font should really exists now. if not, we have a problem + // the font should really exist now. if not, we have a problem // (e.g. if the user did xset fp rehash just when we were searching fonts). // in that case, just return garbage. bool ret = set_properties (p, f); @@ -516,8 +517,6 @@ if (!f) return false; - unsigned long value; - const char *registry = get_property (f, "CHARSET_REGISTRY", 0); const char *encoding = get_property (f, "CHARSET_ENCODING", 0); @@ -613,8 +612,8 @@ if (encm) { - int byte1 = ch >> 8; - int byte2 = ch & 255; + unsigned char byte1 = ch >> 8; + unsigned char byte2 = ch & 255; if (byte1 < f->min_byte1 || byte1 > f->max_byte1 || byte2 < f->min_char_or_byte2 || byte2 > f->max_char_or_byte2) @@ -763,17 +762,17 @@ void rxvt_font_xft::clear () { - if (f) - { - XftFontClose (DISPLAY, f); - f = 0; - } - if (d) { XftDrawDestroy (d); d = 0; } + + if (f) + { + XftFontClose (DISPLAY, f); + f = 0; + } } rxvt_fontprop @@ -879,6 +878,10 @@ XftUnlockFace (f); + d = XftDrawCreate (DISPLAY, DRAWABLE, r->display->visual, r->display->cmap); + if (!d) + return false; + return true; } @@ -893,12 +896,6 @@ const text_t *text, int len, int fg, int bg) { - if (!d) - { - dR; - d = XftDrawCreate (DISPLAY, DRAWABLE, XVISUAL, XCMAP); - } - if (bg >= 0 && bg != Color_bg) XftDrawRect (d, &r->PixColors[bg].c, x, y, r->TermWin.fwidth * len, r->TermWin.fheight); else @@ -948,9 +945,7 @@ ///////////////////////////////////////////////////////////////////////////// rxvt_fontset::rxvt_fontset (rxvt_t r) -#ifdef EXPLICIT_CONTEXT -: r(r) -#endif +: r (r) { clear (); } @@ -963,7 +958,7 @@ void rxvt_fontset::clear () { - for (rxvt_font **i = fonts.begin (); i != fonts.end(); i++) + for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) FONT_UNREF (*i); fonts.clear (); @@ -1027,7 +1022,7 @@ { fprintf (stderr, "extra font parameters not yet supported, skipping.\n"); - const char *extra = desc++; + //const char *extra = desc++; // not yet used desc = strchr (desc, ']'); @@ -1090,14 +1085,14 @@ base_id = 1; // we currently need a base-font, no matter what - if (fonts.size () <= base_id || !realize_font (base_id)) + if ((int)fonts.size () <= base_id || !realize_font (base_id)) { - puts ("unable to load specified font(s), falling back to 'fixed'\n"); + puts ("unable to load specified font (s), falling back to 'fixed'\n"); add_fonts ("fixed"); base_id = fonts.size () - 1; } - if (fonts.size () <= base_id || !realize_font (base_id)) + if ((int)fonts.size () <= base_id || !realize_font (base_id)) { fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n"); exit (1); @@ -1109,7 +1104,7 @@ int rxvt_fontset::find_font (uint32_t unicode) { - for (int i = 0; i < fonts.size (); i++) + for (unsigned int i = 0; i < fonts.size (); i++) { rxvt_font *f = fonts[i];