aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/XFontImp.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-12-09 22:12:56 (GMT)
committerfluxgen <fluxgen>2002-12-09 22:12:56 (GMT)
commitc563042bddf693b0ee26cdee83a7ddbddab3df89 (patch)
tree325f181ca237be01e1f41f416eb9b30849c3dbe1 /src/FbTk/XFontImp.cc
parent6073c44a8ede73f0bdee973a450b596d5d7a9348 (diff)
downloadfluxbox_paul-c563042bddf693b0ee26cdee83a7ddbddab3df89.zip
fluxbox_paul-c563042bddf693b0ee26cdee83a7ddbddab3df89.tar.bz2
fixed bug in rotate
Diffstat (limited to 'src/FbTk/XFontImp.cc')
-rw-r--r--src/FbTk/XFontImp.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/FbTk/XFontImp.cc b/src/FbTk/XFontImp.cc
index e7709df..66adee3 100644
--- a/src/FbTk/XFontImp.cc
+++ b/src/FbTk/XFontImp.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: XFontImp.cc,v 1.4 2002/12/01 13:42:14 rathnor Exp $ 22// $Id: XFontImp.cc,v 1.5 2002/12/09 22:12:56 fluxgen Exp $
23 23
24#include "XFontImp.hh" 24#include "XFontImp.hh"
25#include "App.hh" 25#include "App.hh"
@@ -34,7 +34,7 @@ using namespace std;
34namespace FbTk { 34namespace FbTk {
35 35
36XFontImp::XFontImp(const char *fontname):m_rotfont(0), m_fontstruct(0), 36XFontImp::XFontImp(const char *fontname):m_rotfont(0), m_fontstruct(0),
37 m_angle(0) { 37 m_angle(0), m_rotate(true) {
38 if (fontname != 0) 38 if (fontname != 0)
39 load(fontname); 39 load(fontname);
40} 40}
@@ -63,6 +63,12 @@ bool XFontImp::load(const std::string &fontname) {
63 XFreeFont(App::instance()->display(), m_fontstruct); 63 XFreeFont(App::instance()->display(), m_fontstruct);
64 64
65 m_fontstruct = font; //set new font 65 m_fontstruct = font; //set new font
66
67 if (m_rotfont != 0) {
68 freeRotFont(); // free old rotated font
69 rotate(m_angle); // allocate new rotated font and rotate it to old angle
70 }
71
66 return true; 72 return true;
67} 73}
68 74
@@ -70,7 +76,7 @@ void XFontImp::drawText(Drawable w, int screen, GC gc, const char *text, size_t
70 if (m_fontstruct == 0) 76 if (m_fontstruct == 0)
71 return; 77 return;
72 // use roated font functions? 78 // use roated font functions?
73 if (m_rotfont != 0) { 79 if (m_rotfont != 0 && m_rotate) {
74 drawRotText(w, screen, gc, text, len, x, y); 80 drawRotText(w, screen, gc, text, len, x, y);
75 return; 81 return;
76 } 82 }
@@ -101,18 +107,24 @@ unsigned int XFontImp::height() const {
101 107
102void XFontImp::rotate(float angle) { 108void XFontImp::rotate(float angle) {
103 //we must have a font loaded before we rotate 109 //we must have a font loaded before we rotate
104 if (m_fontstruct == 0) 110 if (m_fontstruct == 0 || m_fontstruct->per_char == 0)
105 return; 111 return;
112
106 if (m_rotfont != 0) 113 if (m_rotfont != 0)
107 freeRotFont(); 114 freeRotFont();
115
108 // no need for rotating, use regular font 116 // no need for rotating, use regular font
109 if (angle == 0) 117 if (angle == 0) {
118 m_angle = 0;
110 return; 119 return;
120 }
111 121
112 //get positive angle 122 //get positive angle
113 while (angle < 0) 123 while (angle < 0)
114 angle += 360; 124 angle += 360;
115 125
126 m_angle = angle;
127
116 char val; 128 char val;
117 XImage *I1, *I2; 129 XImage *I1, *I2;
118 // X system default vars 130 // X system default vars