diff options
author | fluxgen <fluxgen> | 2002-11-25 14:07:21 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-11-25 14:07:21 (GMT) |
commit | 99c92a637392a988382559d0b162aed68ab83ba8 (patch) | |
tree | d353aa10684ed0814327a64e9aef041510e08a41 /src/Font.cc | |
parent | 1fc16d3d3d8a62a9697f4a42044b695707fe5d50 (diff) | |
download | fluxbox_pavel-99c92a637392a988382559d0b162aed68ab83ba8.zip fluxbox_pavel-99c92a637392a988382559d0b162aed68ab83ba8.tar.bz2 |
fixed rotated text on vertical tab in XFontImp and a rotate function in FontImp interface
Diffstat (limited to 'src/Font.cc')
-rw-r--r-- | src/Font.cc | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/Font.cc b/src/Font.cc index a3d3b29..8f683d9 100644 --- a/src/Font.cc +++ b/src/Font.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: Font.cc,v 1.21 2002/11/24 05:23:36 rathnor Exp $ | 22 | //$Id: Font.cc,v 1.22 2002/11/25 14:07:21 fluxgen Exp $ |
23 | 23 | ||
24 | 24 | ||
25 | #include "Font.hh" | 25 | #include "Font.hh" |
@@ -69,7 +69,7 @@ bool Font::m_utf8mode = false; | |||
69 | 69 | ||
70 | Font::Font(const char *name, bool antialias): | 70 | Font::Font(const char *name, bool antialias): |
71 | m_fontimp(0), | 71 | m_fontimp(0), |
72 | m_antialias(false) { | 72 | m_antialias(false), m_rotated(false) { |
73 | 73 | ||
74 | // MB_CUR_MAX returns the size of a char in the current locale | 74 | // MB_CUR_MAX returns the size of a char in the current locale |
75 | if (MB_CUR_MAX > 1) // more than one byte, then we're multibyte | 75 | if (MB_CUR_MAX > 1) // more than one byte, then we're multibyte |
@@ -115,7 +115,7 @@ Font::~Font() { | |||
115 | void Font::setAntialias(bool flag) { | 115 | void Font::setAntialias(bool flag) { |
116 | bool loaded = m_fontimp->loaded(); | 116 | bool loaded = m_fontimp->loaded(); |
117 | #ifdef USE_XFT | 117 | #ifdef USE_XFT |
118 | if (flag && !isAntialias()) { | 118 | if (flag && !isAntialias() && !m_rotated) { |
119 | m_fontimp.reset(new XftFontImp(m_fontstr.c_str(), m_utf8mode)); | 119 | m_fontimp.reset(new XftFontImp(m_fontstr.c_str(), m_utf8mode)); |
120 | } else if (!flag && isAntialias()) | 120 | } else if (!flag && isAntialias()) |
121 | #endif // USE_XFT | 121 | #endif // USE_XFT |
@@ -164,4 +164,23 @@ void Font::drawText(Drawable w, int screen, GC gc, const char *text, size_t len, | |||
164 | m_fontimp->drawText(w, screen, gc, text, len, x, y); | 164 | m_fontimp->drawText(w, screen, gc, text, len, x, y); |
165 | } | 165 | } |
166 | 166 | ||
167 | void Font::rotate(float angle) { | ||
168 | #ifdef USE_XFT | ||
169 | // if we are rotated and we are changing to horiz text | ||
170 | // and we were antialiased before we rotated then change to XftFontImp | ||
171 | if (isRotated() && angle == 0 && isAntialias()) | ||
172 | m_fontimp.reset(new XftFontImp(m_fontstr.c_str(), m_utf8mode)); | ||
173 | #endif // USE_XFT | ||
174 | // change to a font imp that handles rotated fonts (i.e just XFontImp at the moment) | ||
175 | // if we're going to rotate this font | ||
176 | if (angle != 0 && isAntialias() && !isRotated()) { | ||
177 | m_fontimp.reset(new XFontImp(m_fontstr.c_str())); | ||
178 | } | ||
179 | |||
180 | //Note: only XFontImp implements FontImp::rotate | ||
181 | m_fontimp->rotate(angle); | ||
182 | |||
183 | m_rotated = (angle == 0 ? false : true); | ||
184 | } | ||
185 | |||
167 | }; | 186 | }; |