… | |
… | |
23 | #include "rxvt.h" |
23 | #include "rxvt.h" |
24 | #include "defaultfont.h" |
24 | #include "defaultfont.h" |
25 | |
25 | |
26 | #include <cstdlib> |
26 | #include <cstdlib> |
27 | |
27 | |
28 | #define DISPLAY r->Xdisplay |
28 | #define DISPLAY r->display->display |
29 | #define DRAWABLE r->TermWin.vt |
29 | #define DRAWABLE r->TermWin.vt |
30 | #define GC r->TermWin.gc |
30 | #define GC r->TermWin.gc |
31 | |
31 | |
32 | const struct rxvt_fallback_font { |
32 | const struct rxvt_fallback_font { |
33 | codeset cs; |
33 | codeset cs; |
… | |
… | |
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) |
895 | if (!d) |
896 | d = XftDrawCreate (DISPLAY, DRAWABLE, r->Xvisual, r->Xcmap); |
896 | d = XftDrawCreate (DISPLAY, DRAWABLE, r->display->visual, r->display->cmap); |
897 | |
897 | |
898 | if (bg >= 0 && bg != Color_bg) |
898 | if (bg >= 0 && bg != Color_bg) |
899 | XftDrawRect (d, &r->PixColors[bg].c, x, y, r->TermWin.fwidth * len, r->TermWin.fheight); |
899 | XftDrawRect (d, &r->PixColors[bg].c, x, y, r->TermWin.fwidth * len, r->TermWin.fheight); |
900 | else |
900 | else |
901 | clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
901 | clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); |
… | |
… | |
942 | #endif |
942 | #endif |
943 | |
943 | |
944 | ///////////////////////////////////////////////////////////////////////////// |
944 | ///////////////////////////////////////////////////////////////////////////// |
945 | |
945 | |
946 | rxvt_fontset::rxvt_fontset (rxvt_t r) |
946 | rxvt_fontset::rxvt_fontset (rxvt_t r) |
947 | : r(r) |
947 | : r (r) |
948 | { |
948 | { |
949 | clear (); |
949 | clear (); |
950 | } |
950 | } |
951 | |
951 | |
952 | rxvt_fontset::~rxvt_fontset () |
952 | rxvt_fontset::~rxvt_fontset () |
… | |
… | |
955 | } |
955 | } |
956 | |
956 | |
957 | void |
957 | void |
958 | rxvt_fontset::clear () |
958 | rxvt_fontset::clear () |
959 | { |
959 | { |
960 | for (rxvt_font **i = fonts.begin (); i != fonts.end(); i++) |
960 | for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) |
961 | FONT_UNREF (*i); |
961 | FONT_UNREF (*i); |
962 | |
962 | |
963 | fonts.clear (); |
963 | fonts.clear (); |
964 | base_id = 0; |
964 | base_id = 0; |
965 | base_prop.height = 0x7fffffff; |
965 | base_prop.height = 0x7fffffff; |
… | |
… | |
1084 | base_id = 1; |
1084 | base_id = 1; |
1085 | |
1085 | |
1086 | // we currently need a base-font, no matter what |
1086 | // we currently need a base-font, no matter what |
1087 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1087 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1088 | { |
1088 | { |
1089 | puts ("unable to load specified font(s), falling back to 'fixed'\n"); |
1089 | puts ("unable to load specified font (s), falling back to 'fixed'\n"); |
1090 | add_fonts ("fixed"); |
1090 | add_fonts ("fixed"); |
1091 | base_id = fonts.size () - 1; |
1091 | base_id = fonts.size () - 1; |
1092 | } |
1092 | } |
1093 | |
1093 | |
1094 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |
1094 | if ((int)fonts.size () <= base_id || !realize_font (base_id)) |