1 // -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2; -*-
6 #define _XFT_NO_COMPAT_ // no Xft 1 API
7 #include <X11/Xft/Xft.h>
10 extern PyTypeObject OtkFont_Type
;
15 #define OTKFONTHEIGHT(font) (font->xftfont->height + \
16 (font->shadow ? font->offset : 0))
17 #define OTKFONTMAXCHARWIDTH(font) (font->xftfont->max_advance_width)
19 typedef struct OtkFont
{
28 void OtkFont_Initialize();
30 PyObject
*OtkFont_New(int screen
, const char *fontstring
, Bool shadow
,
31 unsigned char offset
, unsigned char tint
);
33 int OtkFont_MeasureString(OtkFont
*self
, const char *string
);//, Bool utf8);
35 //! Draws a string into an XftDraw object
37 Be Warned: If you use an XftDraw object and a color, or a font from
38 different screens, you WILL have unpredictable results! :)
40 void OtkFont_DrawString(OtkFont
*self
, XftDraw
*d
, int x
, int y
,
41 struct OtkColor
*color
, const char *string
);//, Bool utf8);
44 bool createXftFont(void);
48 BFont(int screen_num, const std::string &fontstring, bool shadow,
49 unsigned char offset, unsigned char tint);
52 inline const std::string &fontstring() const { return _fontstring; }
54 unsigned int height() const;
55 unsigned int maxCharWidth() const;
57 unsigned int measureString(const std::string &string,
58 bool utf8 = false) const;