ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtfont.h
Revision: 1.24
Committed: Thu Oct 18 09:11:43 2007 UTC (16 years, 7 months ago) by ayin
Content type: text/plain
Branch: MAIN
CVS Tags: rel-8_5a, rel-8_9, rel-8_8, rel-8_4, rel-9_0, rel-8_6, rel-8_7, rel-9_02, rel-9_01, rel-9_05
Changes since 1.23: +0 -13 lines
Log Message:
include cleanup.

File Contents

# User Rev Content
1 root 1.1 #ifndef DEFAULTFONT_H_
2     #define DEFAULTFONT_H_
3    
4     #include <X11/Xlib.h>
5     #if XFT
6     # include <X11/Xft/Xft.h>
7     #endif
8    
9     #include <inttypes.h>
10    
11     #include "feature.h"
12     #include "encoding.h"
13     #include "rxvtutil.h"
14 root 1.12 #include "rxvttoolkit.h"
15    
16     struct rxvt_term;
17 root 1.1
18     struct rxvt_fontprop {
19     enum {
20 root 1.12 unset = -1,
21 root 1.1 medium = 100, bold = 200,
22     roman = 0, italic = 100,
23     };
24 root 1.17 int width, height, ascent;
25 root 1.1 int weight, slant;
26     };
27    
28     struct rxvt_font {
29     // managed by the fontset
30 root 1.18 rxvt_term *term;
31     void set_term (rxvt_term *term) { this->term = term; }
32 root 1.1
33     char *name;
34     codeset cs;
35     bool loaded; // wether we tried loading it before (not wether it's loaded)
36    
37     // managed by the font object
38     int ascent, descent,
39     width, height;
40    
41 root 1.12 void set_name (char *name);
42 root 1.1
43 root 1.20 rxvt_font ();
44 root 1.12 virtual ~rxvt_font () { free (name); };
45    
46     virtual void clear () { };
47 root 1.1
48 root 1.18 void clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const;
49 root 1.1
50     virtual rxvt_fontprop properties () = 0;
51    
52 root 1.22 virtual bool load (const rxvt_fontprop &morph, bool force_prop) = 0;
53 root 1.18 virtual bool has_char (uint32_t unicode, const rxvt_fontprop *prop, bool &careful) const = 0;
54 root 1.1
55     virtual void draw (rxvt_drawable &d,
56     int x, int y,
57     const text_t *text, int len,
58     int fg, int bg) = 0;
59     };
60    
61     #define FONT_UNREF(f) do { (f)->clear (); delete (f); } while (0)
62    
63     struct rxvt_fallback_font;
64    
65     struct rxvt_fontset {
66     char *fontdesc;
67    
68 root 1.18 rxvt_fontset (rxvt_term *term);
69 root 1.1 ~rxvt_fontset ();
70    
71 root 1.13 bool populate (const char *desc);
72 root 1.22 void set_prop (const rxvt_fontprop &prop, bool force_prop) { this->prop = prop; this->force_prop = force_prop; }
73 root 1.12 int find_font (uint32_t unicode);
74 root 1.1 int find_font (const char *name) const;
75 root 1.12 bool realize_font (int i);
76 root 1.1
77 root 1.12 // font-id's MUST fit into a signed 16 bit integer, and within 0..255
78 root 1.1 rxvt_font *operator [] (int id) const
79     {
80 root 1.12 return fonts[id & 0x7f];
81 root 1.1 }
82    
83     private:
84 root 1.18 rxvt_term *term;
85 root 1.13 rxvt_fontprop prop;
86 root 1.22 bool force_prop;
87 root 1.1 simplevec<rxvt_font *> fonts;
88     const rxvt_fallback_font *fallback;
89    
90 root 1.12 typedef unsigned char pagemap[256];
91     vector<pagemap *> fmap;
92 root 1.1
93 root 1.13 void clear ();
94     rxvt_font *new_font (const char *name, codeset cs);
95 root 1.1 void add_fonts (const char *desc);
96     };
97    
98     #endif /* _DEFAULTFONT_H_ */
99