]> icculus.org git repositories - mikachu/openbox.git/blob - otk_c/font.h
otk using ustring for shit that draws. expended its inferface yet some more.
[mikachu/openbox.git] / otk_c / font.h
1 // -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __font_h
3 #define   __font_h
4
5 #include <X11/Xlib.h>
6 #define _XFT_NO_COMPAT_ // no Xft 1 API
7 #include <X11/Xft/Xft.h>
8 #include <Python.h>
9
10 extern PyTypeObject OtkFont_Type;
11
12 struct OtkColor;
13 struct ScreenInfo;
14
15 #define OTKFONTHEIGHT(font) (font->xftfont->height + \
16                              (font->shadow ? font->offset : 0))
17 #define OTKFONTMAXCHARWIDTH(font) (font->xftfont->max_advance_width)
18
19 typedef struct OtkFont {
20   PyObject_HEAD
21   int               screen;
22   Bool              shadow;
23   unsigned char     offset;
24   unsigned char     tint;
25   XftFont          *xftfont;
26 } OtkFont;
27
28 void OtkFont_Initialize();
29
30 PyObject *OtkFont_New(int screen, const char *fontstring, Bool shadow,
31                       unsigned char offset, unsigned char tint);
32
33 int OtkFont_MeasureString(OtkFont *self, const char *string);//, Bool utf8);
34
35 //! Draws a string into an XftDraw object
36 /*!
37   Be Warned: If you use an XftDraw object and a color, or a font from
38   different screens, you WILL have unpredictable results! :)
39 */
40 void OtkFont_DrawString(OtkFont *self, XftDraw *d, int x, int y,
41                         struct OtkColor *color, const char *string);//, Bool utf8);
42
43 /*
44   bool createXftFont(void);
45   
46 public:
47   // loads an Xft font
48   BFont(int screen_num, const std::string &fontstring, bool shadow,
49         unsigned char offset, unsigned char tint);
50   virtual ~BFont();
51
52   inline const std::string &fontstring() const { return _fontstring; }
53
54   unsigned int height() const;
55   unsigned int maxCharWidth() const;
56
57   unsigned int measureString(const std::string &string,
58                              bool utf8 = false) const;
59
60 };
61
62 }
63 */
64 #endif // __font_h