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