… | |
… | |
47 | if (this->name) free (this->name); // let the compiler optimize |
47 | if (this->name) free (this->name); // let the compiler optimize |
48 | this->name = name; |
48 | this->name = name; |
49 | } |
49 | } |
50 | |
50 | |
51 | rxvt_font () { name = 0; } |
51 | rxvt_font () { name = 0; } |
52 | ~rxvt_font () { clear (); free (name); }; |
52 | ~rxvt_font () { free (name); }; |
53 | |
53 | |
54 | void clear_rect (int x, int y, int w, int h, int color); |
54 | void clear_rect (int x, int y, int w, int h, int color); |
55 | |
55 | |
56 | virtual void clear () { }; |
56 | virtual void clear () { }; |
57 | |
57 | |
… | |
… | |
63 | virtual void draw (int x, int y, |
63 | virtual void draw (int x, int y, |
64 | const text_t *text, int len, |
64 | const text_t *text, int len, |
65 | int fg, int bg) = 0; |
65 | int fg, int bg) = 0; |
66 | }; |
66 | }; |
67 | |
67 | |
68 | //#define FONT_REF(obj) (obj)->refcnt++ |
68 | #define FONT_UNREF(f) do { (f)->clear (); delete (f); } while (0) |
69 | //#define FONT_UNREF(obj) if (!--(obj)->refcnt) delete (obj) |
|
|
70 | #define FONT_UNREF(f) delete f |
|
|
71 | |
69 | |
72 | struct rxvt_fallback_font; |
70 | struct rxvt_fallback_font; |
73 | |
71 | |
74 | struct rxvt_fontset { |
72 | struct rxvt_fontset { |
75 | rxvt_fontset (rxvt_t r); |
73 | rxvt_fontset (rxvt_t r); |
76 | ~rxvt_fontset (); |
74 | ~rxvt_fontset (); |
77 | |
75 | |
78 | rxvt_font *new_font (const char *name, codeset cs); |
76 | rxvt_font *new_font (const char *name, codeset cs); |
79 | |
77 | |
80 | void populate (const char *desc); |
78 | bool populate (const char *desc); |
81 | int find_font (uint32_t unicode); |
79 | int find_font (uint32_t unicode); |
82 | |
80 | |
83 | rxvt_font *operator [](int id) const |
81 | rxvt_font *operator [] (int id) const |
84 | { |
82 | { |
85 | return fonts[id]; |
83 | return fonts[id]; |
86 | } |
84 | } |
87 | |
85 | |
88 | rxvt_font *base_font () const |
86 | rxvt_font *base_font () const |