summaryrefslogtreecommitdiff
path: root/otk_c/font.h
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-21 13:49:57 +0000
committerDana Jansens <danakj@orodu.net>2002-12-21 13:49:57 +0000
commit55b2aaf973063796a668bc758232141c3d6f5cc9 (patch)
tree5d61fe0ac903b5130ec85997296befab7909bdf9 /otk_c/font.h
parent16e1192e4d18cd0d32b1ab8bf38ac8d69347229d (diff)
add font
Diffstat (limited to 'otk_c/font.h')
-rw-r--r--otk_c/font.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/otk_c/font.h b/otk_c/font.h
new file mode 100644
index 00000000..637a215d
--- /dev/null
+++ b/otk_c/font.h
@@ -0,0 +1,64 @@
+// -*- mode: C; indent-tabs-mode: nil; -*-
+#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