]> icculus.org git repositories - mikachu/openbox.git/blob - otk/font.hh
kill the const
[mikachu/openbox.git] / otk / font.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __font_hh
3 #define   __font_hh
4
5 #include "ustring.hh"
6 #include "truerendercontrol.hh"
7
8 extern "C" {
9 #include <X11/Xlib.h>
10 #define _XFT_NO_COMPAT_ // no Xft 1 API
11 #include <X11/Xft/Xft.h>
12 }
13
14 #include <cassert>
15
16 namespace otk {
17
18 class Color;
19 class Surface;
20
21 class Font {
22   /*
23    * static members
24    */
25 private:
26   static bool       _xft_init;
27
28   int               _screen_num;
29
30   std::string       _fontstring;
31
32   bool              _shadow;
33   unsigned char     _offset;
34   unsigned char     _tint;
35
36   XftFont          *_xftfont;
37
38   bool createXftFont(void);
39   
40 public:
41   // loads an Xft font
42   Font(int screen_num, const std::string &fontstring, bool shadow,
43         unsigned char offset, unsigned char tint);
44   virtual ~Font();
45
46   inline const std::string &fontstring() const { return _fontstring; }
47
48   int height() const;
49   int maxCharWidth() const;
50
51   int measureString(const ustring &string) const;
52
53   // The RenderControl classes use the internal data to render the fonts, but
54   // noone else needs it, so its private.
55   friend class RenderControl;
56 };
57
58 }
59
60 #endif // __font_hh