6 # include <X11/Xft/Xft.h>
14 #include "rxvttoolkit.h"
22 medium = 100, bold = 200,
23 roman = 0, italic = 100,
25 int width, height, ascent;
31 // managed by the fontset
33 void set_term (rxvt_term *term) { this->term = term; }
37 bool loaded; // whether we tried loading it before (not whether it's loaded)
39 // managed by the font object
43 void set_name (char *name_);
46 virtual ~rxvt_font () { free (name); };
48 virtual void clear () { };
50 void clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const;
52 virtual rxvt_fontprop properties () = 0;
54 virtual bool load (const rxvt_fontprop &morph, bool force_prop) = 0;
55 virtual bool has_char (uint32_t unicode, const rxvt_fontprop *prop, bool &careful) const = 0;
57 virtual void draw (rxvt_drawable &d,
59 const text_t *text, int len,
63 #define FONT_UNREF(f) do { (f)->clear (); delete (f); } while (0)
65 struct rxvt_fallback_font;
71 enum { fontCount = 15 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
72 enum { firstFont = 2 }; // index of first font in set
74 rxvt_fontset (rxvt_term *term);
77 bool populate (const char *desc);
78 void set_prop (const rxvt_fontprop &prop, bool force_prop) { this->prop = prop; this->force_prop = force_prop; }
79 int find_font_idx (uint32_t unicode);
80 int find_font (const char *name) const;
81 bool realize_font (int i);
83 rxvt_font *operator [] (int id) const
85 return fonts[id >> 1];
89 find_font (unicode_t unicode)
91 return min<int> ((fontCount << 1) | 1, find_font_idx (unicode));
98 simplevec<rxvt_font *> fonts;
99 const rxvt_fallback_font *fallback;
101 typedef unsigned char pagemap[256];
102 vector<pagemap *> fmap;
105 rxvt_font *new_font (const char *name, codeset cs);
106 void prepare_font (rxvt_font *font, codeset cs);
107 void add_fonts (const char *desc);
108 void push_font (rxvt_font *font);
111 #endif /* _DEFAULTFONT_H_ */