1 | /* |
1 | /* |
2 | * $Id: defaultfont.h,v 1.5 2003/11/25 15:25:17 pcg Exp $ |
2 | * $Id: defaultfont.h,v 1.7 2003/12/18 04:14:30 pcg Exp $ |
3 | */ |
3 | */ |
4 | |
4 | |
5 | #ifndef _DEFAULTFONT_H_ |
5 | #ifndef _DEFAULTFONT_H_ |
6 | #define _DEFAULTFONT_H_ |
6 | #define _DEFAULTFONT_H_ |
7 | |
7 | |
… | |
… | |
21 | #include "rxvtlib.h" |
21 | #include "rxvtlib.h" |
22 | #include "feature.h" |
22 | #include "feature.h" |
23 | #include "encoding.h" |
23 | #include "encoding.h" |
24 | #include "rxvtvec.h" |
24 | #include "rxvtvec.h" |
25 | |
25 | |
|
|
26 | struct rxvt_fontprop { |
|
|
27 | enum { |
|
|
28 | medium = 100, bold = 200, |
|
|
29 | roman = 0, italic = 100, |
|
|
30 | }; |
|
|
31 | int height; |
|
|
32 | int weight; |
|
|
33 | int slant; |
|
|
34 | }; |
|
|
35 | |
26 | struct rxvt_font { |
36 | struct rxvt_font { |
27 | // managed by the fontset |
37 | // managed by the fontset |
28 | rxvt_t r; |
38 | rxvt_t r; |
29 | void set_term (rxvt_t r) { this->r = r; } |
39 | void set_term (rxvt_t r) { this->r = r; } |
30 | |
40 | |
31 | char *name; |
41 | char *name; |
32 | codeset cs; |
42 | codeset cs; |
33 | bool loaded; |
43 | bool loaded; // wether we tried loading it before (not wether it's loaded) |
34 | |
44 | |
35 | // managed by the font object |
45 | // managed by the font object |
36 | bool prop; // wether this is a proportional font or has other funny characteristics |
46 | bool slow; // wether this is a proportional font or has other funny characteristics |
37 | int ascent, descent, |
47 | int ascent, descent, |
38 | width, height; |
48 | width, height; |
39 | |
49 | |
40 | void set_name (char *name) |
50 | void set_name (char *name) |
41 | { |
51 | { |
… | |
… | |
48 | |
58 | |
49 | void clear_rect (int x, int y, int w, int h, int color); |
59 | void clear_rect (int x, int y, int w, int h, int color); |
50 | |
60 | |
51 | virtual void clear () { }; |
61 | virtual void clear () { }; |
52 | |
62 | |
53 | virtual bool load (int maxheight) = 0; |
63 | virtual rxvt_fontprop properties () = 0; |
|
|
64 | |
|
|
65 | virtual bool load (const rxvt_fontprop &prop) = 0; |
54 | virtual bool has_codepoint (uint32_t unicode) = 0; |
66 | virtual bool has_codepoint (uint32_t unicode) = 0; |
55 | |
67 | |
56 | virtual void draw (int x, int y, |
68 | virtual void draw (int x, int y, |
57 | const text_t *text, int len, |
69 | const text_t *text, int len, |
58 | int fg, int bg) = 0; |
70 | int fg, int bg) = 0; |
… | |
… | |
86 | private: |
98 | private: |
87 | rxvt_t r; |
99 | rxvt_t r; |
88 | simplevec<rxvt_font *> fonts; |
100 | simplevec<rxvt_font *> fonts; |
89 | const rxvt_fallback_font *fallback; |
101 | const rxvt_fallback_font *fallback; |
90 | |
102 | |
91 | int height; |
103 | rxvt_fontprop base_prop; |
92 | int base_id; |
104 | int base_id; |
93 | |
105 | |
94 | bool realize_font (int i); |
106 | bool realize_font (int i); |
95 | void add_fonts (const char *desc); |
107 | void add_fonts (const char *desc); |
96 | void clear (); |
108 | void clear (); |