--- rxvt-unicode/src/rxvtfont.C 2012/01/25 14:33:42 1.186 +++ rxvt-unicode/src/rxvtfont.C 2021/06/17 00:08:35 1.199 @@ -6,7 +6,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -241,8 +241,8 @@ #if XFT Picture dst; -# ifdef HAVE_BG_PIXMAP - if (term->bg_pixmap +# ifdef HAVE_IMG + if (term->bg_img && !term->pix_colors[color].is_opaque () && ((dst = XftDrawPicture (d)))) { @@ -264,7 +264,8 @@ ///////////////////////////////////////////////////////////////////////////// -struct rxvt_font_default : rxvt_font { +struct rxvt_font_default : rxvt_font +{ struct rxvt_fontset *fs; rxvt_font_default (rxvt_fontset *fs) @@ -476,6 +477,15 @@ case NOCHAR: break; + /* + * If the base font does not support variation selectors, treat them as ZWC. + * a point could be made to do this for all wcwidth == 0 characters, but I + * decided against that until more data is available. + */ + case 0xfe00: case 0xfe01: case 0xfe02: case 0xfe03: case 0xfe04: case 0xfe05: case 0xfe06: case 0xfe07: + case 0xfe08: case 0xfe09: case 0xfe0a: case 0xfe0b: case 0xfe0c: case 0xfe0d: case 0xfe0e: case 0xfe0f: + break; + default: XDrawRectangle (disp, d, gc, x + 2, y + 2, fwidth - 4, term->fheight - 4); @@ -485,7 +495,8 @@ } } -struct rxvt_font_overflow : rxvt_font { +struct rxvt_font_overflow : rxvt_font +{ struct rxvt_fontset *fs; rxvt_font_overflow (rxvt_fontset *fs) @@ -541,7 +552,8 @@ ///////////////////////////////////////////////////////////////////////////// -struct rxvt_font_x11 : rxvt_font { +struct rxvt_font_x11 : rxvt_font +{ rxvt_font_x11 () { f = 0; } void clear (); @@ -936,7 +948,8 @@ if (!has_char (*t, &prop, careful)) continue; - XChar2b ch = { *t >> 8, *t }; + // the casts are needed in C++11 (see 8.5.1) + XChar2b ch = { (unsigned char)(*t >> 8), (unsigned char)*t }; XCharStruct g; int dir_ret, asc_ret, des_ret; @@ -1046,7 +1059,8 @@ bool slow = this->slow || width != term->fwidth - || height != term->fheight; + || height != term->fheight + || ascent != f->ascent; int base = ascent; // sorry, incorrect: term->fbase; @@ -1124,8 +1138,12 @@ #if XFT -struct rxvt_font_xft : rxvt_font { - rxvt_font_xft () { f = 0; } +struct rxvt_font_xft : rxvt_font +{ + rxvt_font_xft () + { + f = 0; + } void clear (); @@ -1410,10 +1428,10 @@ { rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); -#ifdef HAVE_BG_PIXMAP +#ifdef HAVE_IMG Picture dst = 0; // the only assignment is done conditionally in the following if condition - if (term->bg_pixmap + if (term->bg_img && (bg == Color_transparent || bg == Color_bg || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) { @@ -1425,10 +1443,10 @@ src_y += term->window_vt_y; } - if (term->bg_pmap_width >= src_x + w - && term->bg_pmap_height >= src_y + h) + if (term->bg_img->w >= src_x + w + && term->bg_img->h >= src_y + h) { - XCopyArea (disp, term->bg_pixmap, d2, gc, + XCopyArea (disp, term->bg_img->pm, d2, gc, src_x, src_y, w, h, 0, 0); } else @@ -1436,7 +1454,7 @@ XGCValues gcv; gcv.fill_style = FillTiled; - gcv.tile = term->bg_pixmap; + gcv.tile = term->bg_img->pm; gcv.ts_x_origin = -src_x; gcv.ts_y_origin = -src_y; @@ -1501,7 +1519,7 @@ (*i)->unref (); for (pagemap **p = fmap.begin (); p != fmap.end (); p++) - delete [] *p; + delete *p; free (fontdesc); fontdesc = 0; @@ -1606,7 +1624,7 @@ rxvt_warn ("unknown parameter '%s' in font specification, skipping.\n", spec); desc++; - while (*desc <= ' ') desc++; + while (*desc <= ' ' && *desc) desc++; } end = strchr (desc, ','); @@ -1734,6 +1752,7 @@ // TODO: this is a real resource hog, xft takes ages(?) #if XFT && USE_SLOW_LOOKUP // grab the first xft font that seems suitable + // TOOD: should go first for cellchar (spacing 110) then mono, then else FcPattern *p = FcPatternCreate (); FcCharSet *s = FcCharSetCreate (); @@ -1787,10 +1806,7 @@ if (!fmap[hi]) { - // C++ has no separate new and new [] - we need the "new" form, - // just like the syntax implies, but since pagemap is char[], - // C++ chooses the wrong new, so we need the cast and delete []. - fmap[hi] = (pagemap *)new pagemap; + fmap[hi] = new pagemap; memset (fmap[hi], 0xff, sizeof (pagemap)); }