… | |
… | |
428 | |
428 | |
429 | XFontStruct *f = XLoadQueryFont (DISPLAY, name); |
429 | XFontStruct *f = XLoadQueryFont (DISPLAY, name); |
430 | |
430 | |
431 | if (f) |
431 | if (f) |
432 | { |
432 | { |
433 | // the font should really exists now. if not, we have a problem |
433 | // the font should really exist now. if not, we have a problem |
434 | // (e.g. if the user did xset fp rehash just when we were searching fonts). |
434 | // (e.g. if the user did xset fp rehash just when we were searching fonts). |
435 | // in that case, just return garbage. |
435 | // in that case, just return garbage. |
436 | bool ret = set_properties (p, f); |
436 | bool ret = set_properties (p, f); |
437 | XFreeFont (DISPLAY, f); |
437 | XFreeFont (DISPLAY, f); |
438 | return ret; |
438 | return ret; |
… | |
… | |
760 | }; |
760 | }; |
761 | |
761 | |
762 | void |
762 | void |
763 | rxvt_font_xft::clear () |
763 | rxvt_font_xft::clear () |
764 | { |
764 | { |
|
|
765 | if (d) |
|
|
766 | { |
|
|
767 | XftDrawDestroy (d); |
|
|
768 | d = 0; |
|
|
769 | } |
|
|
770 | |
765 | if (f) |
771 | if (f) |
766 | { |
772 | { |
767 | XftFontClose (DISPLAY, f); |
773 | XftFontClose (DISPLAY, f); |
768 | f = 0; |
774 | f = 0; |
769 | } |
|
|
770 | |
|
|
771 | if (d) |
|
|
772 | { |
|
|
773 | XftDrawDestroy (d); |
|
|
774 | d = 0; |
|
|
775 | } |
775 | } |
776 | } |
776 | } |
777 | |
777 | |
778 | rxvt_fontprop |
778 | rxvt_fontprop |
779 | rxvt_font_xft::properties () |
779 | rxvt_font_xft::properties () |
… | |
… | |
890 | void |
890 | void |
891 | rxvt_font_xft::draw (int x, int y, |
891 | rxvt_font_xft::draw (int x, int y, |
892 | const text_t *text, int len, |
892 | const text_t *text, int len, |
893 | int fg, int bg) |
893 | int fg, int bg) |
894 | { |
894 | { |
895 | if (!d) |
|
|
896 | d = XftDrawCreate (DISPLAY, DRAWABLE, r->display->visual, r->display->cmap); |
895 | d = XftDrawCreate (DISPLAY, DRAWABLE, r->display->visual, r->display->cmap); |
897 | |
896 | |
898 | if (bg >= 0 && bg != Color_bg) |
897 | if (bg >= 0 && bg != Color_bg) |
899 | XftDrawRect (d, &r->PixColors[bg].c, x, y, r->TermWin.fwidth * len, r->TermWin.fheight); |
898 | XftDrawRect (d, &r->PixColors[bg].c, x, y, r->TermWin.fwidth * len, r->TermWin.fheight); |
900 | else |
899 | else |
901 | clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
900 | clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
… | |
… | |
942 | #endif |
941 | #endif |
943 | |
942 | |
944 | ///////////////////////////////////////////////////////////////////////////// |
943 | ///////////////////////////////////////////////////////////////////////////// |
945 | |
944 | |
946 | rxvt_fontset::rxvt_fontset (rxvt_t r) |
945 | rxvt_fontset::rxvt_fontset (rxvt_t r) |
947 | : r(r) |
946 | : r (r) |
948 | { |
947 | { |
949 | clear (); |
948 | clear (); |
950 | } |
949 | } |
951 | |
950 | |
952 | rxvt_fontset::~rxvt_fontset () |
951 | rxvt_fontset::~rxvt_fontset () |
… | |
… | |
955 | } |
954 | } |
956 | |
955 | |
957 | void |
956 | void |
958 | rxvt_fontset::clear () |
957 | rxvt_fontset::clear () |
959 | { |
958 | { |
960 | for (rxvt_font **i = fonts.begin (); i != fonts.end(); i++) |
959 | for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) |
961 | FONT_UNREF (*i); |
960 | FONT_UNREF (*i); |
962 | |
961 | |
963 | fonts.clear (); |
962 | fonts.clear (); |
964 | base_id = 0; |
963 | base_id = 0; |
965 | base_prop.height = 0x7fffffff; |
964 | base_prop.height = 0x7fffffff; |
… | |
… | |
1084 | base_id = 1; |
1083 | base_id = 1; |
1085 | |
1084 | |
1086 | // we currently need a base-font, no matter what |
1085 | // we currently need a base-font, no matter what |
1087 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1086 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1088 | { |
1087 | { |
1089 | puts ("unable to load specified font(s), falling back to 'fixed'\n"); |
1088 | puts ("unable to load specified font (s), falling back to 'fixed'\n"); |
1090 | add_fonts ("fixed"); |
1089 | add_fonts ("fixed"); |
1091 | base_id = fonts.size () - 1; |
1090 | base_id = fonts.size () - 1; |
1092 | } |
1091 | } |
1093 | |
1092 | |
1094 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1093 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |