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_FONT_HH
00025 #define FBTK_FONT_HH
00026
00027 #include <X11/Xlib.h>
00028 #include <X11/Xresource.h>
00029
00030 #include <string>
00031 #include <memory>
00032
00033 namespace FbTk {
00034
00035 class FontImp;
00036
00040 class Font {
00041 public:
00042
00043 Font(const char *name=0, bool antialias = false);
00044 virtual ~Font();
00050 bool load(const std::string &name);
00051
00053 static bool multibyte() { return m_multibyte; }
00055 static bool utf8() { return m_utf8mode; }
00056 void setAntialias(bool flag);
00057 inline void setShadow(bool flag) { m_shadow = flag; }
00063 unsigned int textWidth(const char * const text, unsigned int size) const;
00064 unsigned int height() const;
00065 int ascent() const;
00066 int descent() const;
00071 void rotate(float angle);
00072
00084 void drawText(Drawable w, int screen, GC gc,
00085 const char *text, size_t len,
00086 int x, int y, bool rotate=true) const;
00087 bool isAntialias() const { return m_antialias; }
00089 bool isRotated() const { return m_rotated; }
00091 float angle() const { return m_angle; }
00092 bool shadow() const { return m_shadow; }
00093 private:
00094
00095 std::auto_ptr<FontImp> m_fontimp;
00096 std::string m_fontstr;
00097 static bool m_multibyte;
00098 static bool m_utf8mode;
00099 bool m_antialias;
00100 bool m_rotated;
00101 float m_angle;
00102 bool m_shadow;
00103 };
00104
00105 }
00106
00107 #endif //FBTK_FONT_HH