00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FBTK_XFTFONTIMP_HH
00025 #define FBTK_XFTFONTIMP_HH
00026
00027 #include "FontImp.hh"
00028
00029 #include <X11/Xft/Xft.h>
00030
00031 namespace FbTk {
00032
00034 class XftFontImp:public FbTk::FontImp {
00035 public:
00036 XftFontImp(const char *fontname, bool utf8);
00037 ~XftFontImp();
00038 bool load(const std::string &name);
00039 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
00040 unsigned int textWidth(const char * const text, unsigned int len) const;
00041 unsigned int height() const;
00042 int ascent() const { return m_xftfont ? m_xftfont->ascent : 0; }
00043 int descent() const { return m_xftfont ? m_xftfont->descent : 0; }
00044 bool loaded() const { return m_xftfont != 0; }
00045 private:
00046 XftFont *m_xftfont;
00047 bool m_utf8mode;
00048 };
00049
00050 }
00051
00052 #endif // FBTK_XFTFONTIMP_HH