6 # include <X11/Xft/Xft.h>
11 # include <X11/Xlocale.h>
13 # ifdef HAVE_SETLOCALE
16 #endif /* HAVE_XLOCALE */
18 #ifdef HAVE_NL_LANGINFO
19 # include <langinfo.h>
27 #include "rxvttoolkit.h"
31 struct rxvt_fontprop {
34 medium = 100, bold = 200,
35 roman = 0, italic = 100,
37 int width, height, ascent;
41 struct rxvt_drawable {
42 rxvt_display *display;
49 rxvt_drawable (rxvt_display *display, Drawable drawable)
61 operator Drawable() { return drawable; }
65 // managed by the fontset
67 void set_term (rxvt_term *term) { this->term = term; }
71 bool loaded; // wether we tried loading it before (not wether it's loaded)
73 // managed by the font object
77 void set_name (char *name);
79 rxvt_font () { name = 0; }
80 virtual ~rxvt_font () { free (name); };
82 virtual void clear () { };
84 void clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const;
86 virtual rxvt_fontprop properties () = 0;
88 virtual bool load (const rxvt_fontprop &morph) = 0;
89 virtual bool has_char (uint32_t unicode, const rxvt_fontprop *prop, bool &careful) const = 0;
91 virtual void draw (rxvt_drawable &d,
93 const text_t *text, int len,
97 #define FONT_UNREF(f) do { (f)->clear (); delete (f); } while (0)
99 struct rxvt_fallback_font;
101 struct rxvt_fontset {
104 rxvt_fontset (rxvt_term *term);
107 bool populate (const char *desc);
108 void set_prop (const rxvt_fontprop &prop) { this->prop = prop; }
109 int find_font (uint32_t unicode);
110 int find_font (const char *name) const;
111 bool realize_font (int i);
113 // font-id's MUST fit into a signed 16 bit integer, and within 0..255
114 rxvt_font *operator [] (int id) const
116 return fonts[id & 0x7f];
122 simplevec<rxvt_font *> fonts;
123 const rxvt_fallback_font *fallback;
125 typedef unsigned char pagemap[256];
126 vector<pagemap *> fmap;
129 rxvt_font *new_font (const char *name, codeset cs);
130 void add_fonts (const char *desc);
133 #endif /* _DEFAULTFONT_H_ */