diff options
Diffstat (limited to 'src/FbTk/XFontImp.hh')
-rw-r--r-- | src/FbTk/XFontImp.hh | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/FbTk/XFontImp.hh b/src/FbTk/XFontImp.hh index 6b5a34b..0312fb5 100644 --- a/src/FbTk/XFontImp.hh +++ b/src/FbTk/XFontImp.hh | |||
@@ -38,50 +38,49 @@ public: | |||
38 | bool load(const std::string &filename); | 38 | bool load(const std::string &filename); |
39 | unsigned int textWidth(const char * const text, unsigned int size) const; | 39 | unsigned int textWidth(const char * const text, unsigned int size) const; |
40 | unsigned int height() const; | 40 | unsigned int height() const; |
41 | int angle() const { return m_angle; } | ||
42 | int ascent() const; | 41 | int ascent() const; |
43 | int descent() const { return m_fontstruct ? m_fontstruct->descent : 0; } | 42 | int descent() const { return m_fontstruct ? m_fontstruct->descent : 0; } |
44 | void drawText(const FbDrawable &w, int screen, GC gc, const char *text, size_t len, int x, int y, FbTk::Orientation orient) const; | 43 | void drawText(const FbDrawable &w, int screen, GC gc, const char *text, size_t len, int x, int y, FbTk::Orientation orient) const; |
45 | 44 | ||
45 | bool validOrientation(FbTk::Orientation orient); | ||
46 | |||
46 | bool loaded() const { return m_fontstruct != 0; } | 47 | bool loaded() const { return m_fontstruct != 0; } |
47 | void rotate(int angle); | 48 | |
48 | /// enable/disable rotation witout alloc/dealloc rotfont structures | ||
49 | void setRotate(bool val) { m_rotate = val; } | ||
50 | private: | 49 | private: |
51 | void freeRotFont(); | ||
52 | void drawRotText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; | ||
53 | unsigned int rotTextWidth(const char * const text, unsigned int size) const; | ||
54 | struct BitmapStruct { | 50 | struct BitmapStruct { |
55 | int bit_w; | 51 | int bit_w; |
56 | int bit_h; | 52 | int bit_h; |
57 | 53 | ||
58 | Pixmap bm; | 54 | Pixmap bm; |
59 | }; | 55 | }; |
60 | |||
61 | struct XRotCharStruct { | 56 | struct XRotCharStruct { |
62 | int ascent; | 57 | int ascent; |
63 | int descent; | 58 | int descent; |
64 | int lbearing; | 59 | int lbearing; |
65 | int rbearing; | 60 | int rbearing; |
66 | int width; | 61 | int width; |
67 | 62 | ||
68 | BitmapStruct glyph; | 63 | BitmapStruct glyph; |
69 | }; | 64 | }; |
70 | 65 | ||
71 | struct XRotFontStruct { | 66 | struct XRotFontStruct { |
72 | int dir; | 67 | int height; |
73 | int height; | 68 | int max_ascent; |
74 | int max_ascent; | 69 | int max_descent; |
75 | int max_descent; | 70 | int max_char; |
76 | int max_char; | ||
77 | int min_char; | 71 | int min_char; |
78 | 72 | ||
79 | XRotCharStruct per_char[95]; | 73 | XRotCharStruct per_char[95]; |
80 | }; | 74 | }; |
81 | XRotFontStruct *m_rotfont; ///< rotated font structure | 75 | |
76 | void rotate(FbTk::Orientation orient); | ||
77 | |||
78 | void freeRotFont(XRotFontStruct * rotfont); | ||
79 | void drawRotText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y, FbTk::Orientation orient) const; | ||
80 | |||
81 | XRotFontStruct *m_rotfonts[4]; ///< rotated font structure (only 3 used) | ||
82 | XFontStruct *m_fontstruct; ///< X font structure | 82 | XFontStruct *m_fontstruct; ///< X font structure |
83 | int m_angle; ///< the rotated angle | 83 | |
84 | bool m_rotate; ///< used to disable/enable rotation temprarly without reallocating m_rotfont | ||
85 | }; | 84 | }; |
86 | 85 | ||
87 | } // end namespace FbTk | 86 | } // end namespace FbTk |