diff options
author | simonb <simonb> | 2006-04-04 12:16:26 (GMT) |
---|---|---|
committer | simonb <simonb> | 2006-04-04 12:16:26 (GMT) |
commit | c243fa897f37dabeade187ac74ea5cd175e80a22 (patch) | |
tree | 6200f9e4daa633ba884af79c92a6f5a4f7a57a70 /src/FbTk/XFontImp.hh | |
parent | 839d9c669be5164413769b77e98cda15bba77a6b (diff) | |
download | fluxbox-c243fa897f37dabeade187ac74ea5cd175e80a22.zip fluxbox-c243fa897f37dabeade187ac74ea5cd175e80a22.tar.bz2 |
rotated XFonts (and minor ext tab alignment fixes)
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 |