ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/defaultfont.h
(Generate patch)

Comparing rxvt-unicode/src/defaultfont.h (file contents):
Revision 1.9 by pcg, Sat Jan 17 01:20:01 2004 UTC vs.
Revision 1.15 by pcg, Fri Feb 27 02:52:51 2004 UTC

1#ifndef DEFAULTFONT_H_ 1#ifndef DEFAULTFONT_H_
2#define DEFAULTFONT_H_ 2#define DEFAULTFONT_H_
3
4#include <X11/Xlib.h>
5#if XFT
6# include <X11/Xft/Xft.h>
7#endif
3 8
4#ifdef HAVE_XSETLOCALE 9#ifdef HAVE_XSETLOCALE
5# define X_LOCALE 10# define X_LOCALE
6# include <X11/Xlocale.h> 11# include <X11/Xlocale.h>
7#else 12#else
26 }; 31 };
27 int width, height; 32 int width, height;
28 int weight, slant; 33 int weight, slant;
29}; 34};
30 35
36struct rxvt_drawable {
37 rxvt_display *display;
38 Drawable drawable;
39#if XFT
40 XftDraw *xftdrawable;
41 operator XftDraw *();
42#endif
43
44 rxvt_drawable (rxvt_display *display, Drawable drawable)
45 : display(display),
46#if XFT
47 xftdrawable(0),
48#endif
49 drawable(drawable)
50 { }
51
52#if XFT
53 ~rxvt_drawable ();
54#endif
55
56 operator Drawable() { return drawable; }
57};
58
31struct rxvt_font { 59struct rxvt_font {
32 // managed by the fontset 60 // managed by the fontset
33 rxvt_t r; 61 rxvt_t r;
34 void set_term (rxvt_t r) { this->r = r; } 62 void set_term (rxvt_t r) { this->r = r; }
35 63
47 if (this->name) free (this->name); // let the compiler optimize 75 if (this->name) free (this->name); // let the compiler optimize
48 this->name = name; 76 this->name = name;
49 } 77 }
50 78
51 rxvt_font () { name = 0; } 79 rxvt_font () { name = 0; }
52 ~rxvt_font () { free (name); clear (); }; 80 ~rxvt_font () { free (name); };
53 81
54 void clear_rect (int x, int y, int w, int h, int color); 82 void clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color);
55 83
56 virtual void clear () { }; 84 virtual void clear () { };
57 85
58 virtual rxvt_fontprop properties () = 0; 86 virtual rxvt_fontprop properties () = 0;
59 87
60 virtual bool load (const rxvt_fontprop &prop) = 0; 88 virtual bool load (const rxvt_fontprop &prop) = 0;
61 virtual bool has_codepoint (uint32_t unicode) = 0; 89 virtual bool has_codepoint (uint32_t unicode) = 0;
62 90
63 virtual void draw (int x, int y, 91 virtual void draw (rxvt_drawable &d,
92 int x, int y,
64 const text_t *text, int len, 93 const text_t *text, int len,
65 int fg, int bg) = 0; 94 int fg, int bg) = 0;
66}; 95};
67 96
68//#define FONT_REF(obj) (obj)->refcnt++ 97#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 98
72struct rxvt_fallback_font; 99struct rxvt_fallback_font;
73 100
74struct rxvt_fontset { 101struct rxvt_fontset {
75 rxvt_fontset (rxvt_t r); 102 rxvt_fontset (rxvt_t r);
76 ~rxvt_fontset (); 103 ~rxvt_fontset ();
77 104
78 rxvt_font *new_font (const char *name, codeset cs); 105 rxvt_font *new_font (const char *name, codeset cs);
79 106
80 void populate (const char *desc); 107 bool populate (const char *desc);
81 int find_font (uint32_t unicode); 108 int find_font (uint32_t unicode);
82 109
83 rxvt_font *operator [](int id) const 110 rxvt_font *operator [] (int id) const
84 { 111 {
85 return fonts[id]; 112 return fonts[id];
86 } 113 }
87 114
88 rxvt_font *base_font () const 115 rxvt_font *base_font () const

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines