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_XFONTIMP_HH
00025 #define FBTK_XFONTIMP_HH
00026
00027 #include "FontImp.hh"
00028
00029 #include <X11/Xlib.h>
00030
00031 namespace FbTk {
00032
00034 class XFontImp:public FbTk::FontImp {
00035 public:
00036 explicit XFontImp(const char *filename = 0);
00037 ~XFontImp();
00038 bool load(const std::string &filename);
00039 unsigned int textWidth(const char * const text, unsigned int size) const;
00040 unsigned int height() const;
00041 float angle() const { return m_angle; }
00042 int ascent() const;
00043 int descent() const { return m_fontstruct ? m_fontstruct->descent : 0; }
00044 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
00045 bool loaded() const { return m_fontstruct != 0; }
00046 void rotate(float angle);
00048 void setRotate(bool val) { m_rotate = val; }
00049 private:
00050 void freeRotFont();
00051 void drawRotText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
00052 unsigned int rotTextWidth(const char * const text, unsigned int size) const;
00053 struct BitmapStruct {
00054 int bit_w;
00055 int bit_h;
00056
00057 Pixmap bm;
00058 };
00059
00060 struct XRotCharStruct {
00061 int ascent;
00062 int descent;
00063 int lbearing;
00064 int rbearing;
00065 int width;
00066
00067 BitmapStruct glyph;
00068 };
00069
00070 struct XRotFontStruct {
00071 int dir;
00072 int height;
00073 int max_ascent;
00074 int max_descent;
00075 int max_char;
00076 int min_char;
00077
00078 XRotCharStruct per_char[95];
00079 };
00080 XRotFontStruct *m_rotfont;
00081 XFontStruct *m_fontstruct;
00082 float m_angle;
00083 bool m_rotate;
00084 };
00085
00086 }
00087
00088 #endif // XFONTIMP_HH