aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/XmbFontImp.cc
diff options
context:
space:
mode:
authormathias <mathias>2006-10-30 19:31:15 (GMT)
committermathias <mathias>2006-10-30 19:31:15 (GMT)
commite5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5 (patch)
treec84838a84802805e9b1463045e86200b7cef917f /src/FbTk/XmbFontImp.cc
parent426c12c25c2ef095a882619ad7424684b88465b8 (diff)
downloadfluxbox-e5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5.zip
fluxbox-e5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5.tar.bz2
Cosmetic patch from Slava Semushin
Diffstat (limited to 'src/FbTk/XmbFontImp.cc')
-rw-r--r--src/FbTk/XmbFontImp.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc
index 160b0be..9b3c302 100644
--- a/src/FbTk/XmbFontImp.cc
+++ b/src/FbTk/XmbFontImp.cc
@@ -50,7 +50,6 @@
50#else 50#else
51 #include <stdarg.h> 51 #include <stdarg.h>
52#endif 52#endif
53#include <iostream>
54#ifdef HAVE_CSTRING 53#ifdef HAVE_CSTRING
55 #include <cstring> 54 #include <cstring>
56#else 55#else
@@ -59,7 +58,7 @@
59 58
60#include <X11/Xlib.h> 59#include <X11/Xlib.h>
61 60
62using namespace std; 61using std::string;
63 62
64namespace { 63namespace {
65 64
@@ -118,7 +117,7 @@ XFontSet createFontSet(const char *fontname, bool& utf8mode) {
118 XFontSet fs; 117 XFontSet fs;
119 char **missing, *def = "-"; 118 char **missing, *def = "-";
120 int nmissing; 119 int nmissing;
121 std::string orig_locale = ""; 120 string orig_locale = "";
122 121
123#ifdef HAVE_SETLOCALE 122#ifdef HAVE_SETLOCALE
124 if (utf8mode) { 123 if (utf8mode) {
@@ -156,7 +155,7 @@ XFontSet createFontSet(const char *fontname, bool& utf8mode) {
156 155
157 // set to false because our strings won't be utf8-happy 156 // set to false because our strings won't be utf8-happy
158 utf8mode = false; 157 utf8mode = false;
159 158
160 return fs; 159 return fs;
161} 160}
162 161
@@ -173,7 +172,7 @@ XmbFontImp::~XmbFontImp() {
173 XFreeFontSet(App::instance()->display(), m_fontset); 172 XFreeFontSet(App::instance()->display(), m_fontset);
174} 173}
175 174
176bool XmbFontImp::load(const std::string &fontname) { 175bool XmbFontImp::load(const string &fontname) {
177 if (fontname.empty()) 176 if (fontname.empty())
178 return false; 177 return false;
179 178
@@ -205,8 +204,8 @@ void XmbFontImp::drawText(const FbDrawable &d, int screen, GC main_gc, const FbS
205 } else 204 } else
206#endif //X_HAVE_UTF8_STRING 205#endif //X_HAVE_UTF8_STRING
207 { 206 {
208 std::string localestr = text; 207 string localestr = text;
209 localestr.erase(len, std::string::npos); 208 localestr.erase(len, string::npos);
210 localestr = FbStringUtil::FbStrToLocale(localestr); 209 localestr = FbStringUtil::FbStrToLocale(localestr);
211 XmbDrawString(d.display(), d.drawable(), m_fontset, 210 XmbDrawString(d.display(), d.drawable(), m_fontset,
212 main_gc, x, y, 211 main_gc, x, y,
@@ -226,7 +225,7 @@ void XmbFontImp::drawText(const FbDrawable &d, int screen, GC main_gc, const FbS
226 225
227 // not straight forward, we actually draw it elsewhere, then rotate it 226 // not straight forward, we actually draw it elsewhere, then rotate it
228 FbTk::FbPixmap canvas(d.drawable(), w, h, 1); 227 FbTk::FbPixmap canvas(d.drawable(), w, h, 1);
229 228
230 // create graphic context for our canvas 229 // create graphic context for our canvas
231 FbTk::GContext font_gc(canvas); 230 FbTk::GContext font_gc(canvas);
232 font_gc.setBackground(None); 231 font_gc.setBackground(None);
@@ -244,8 +243,8 @@ void XmbFontImp::drawText(const FbDrawable &d, int screen, GC main_gc, const FbS
244 } else 243 } else
245#endif //X_HAVE_UTF8_STRING 244#endif //X_HAVE_UTF8_STRING
246 { 245 {
247 std::string localestr = text; 246 string localestr = text;
248 localestr.erase(len, std::string::npos); 247 localestr.erase(len, string::npos);
249 localestr = FbStringUtil::FbStrToLocale(localestr); 248 localestr = FbStringUtil::FbStrToLocale(localestr);
250 XmbDrawString(dpy, canvas.drawable(), m_fontset, 249 XmbDrawString(dpy, canvas.drawable(), m_fontset,
251 font_gc.gc(), xpos, ypos, 250 font_gc.gc(), xpos, ypos,
@@ -260,7 +259,7 @@ void XmbFontImp::drawText(const FbDrawable &d, int screen, GC main_gc, const FbS
260 259
261 // vertical or upside down 260 // vertical or upside down
262 261
263 XSetFillStyle(dpy, my_gc, FillStippled); 262 XSetFillStyle(dpy, my_gc, FillStippled);
264 263
265 // vertical or upside down 264 // vertical or upside down
266 265
@@ -275,7 +274,7 @@ void XmbFontImp::drawText(const FbDrawable &d, int screen, GC main_gc, const FbS
275 canvas.height()); 274 canvas.height());
276 275
277 XFreeGC(dpy, my_gc); 276 XFreeGC(dpy, my_gc);
278 277
279} 278}
280 279
281unsigned int XmbFontImp::textWidth(const FbString &text, unsigned int len) const { 280unsigned int XmbFontImp::textWidth(const FbString &text, unsigned int len) const {
@@ -292,8 +291,8 @@ unsigned int XmbFontImp::textWidth(const FbString &text, unsigned int len) const
292 } 291 }
293#endif // X_HAVE_UTF8_STRING 292#endif // X_HAVE_UTF8_STRING
294 293
295 std::string localestr = text; 294 string localestr = text;
296 localestr.erase(len, std::string::npos); 295 localestr.erase(len, string::npos);
297 localestr = FbStringUtil::FbStrToLocale(localestr); 296 localestr = FbStringUtil::FbStrToLocale(localestr);
298 XmbTextExtents(m_fontset, localestr.data(), localestr.size(), 297 XmbTextExtents(m_fontset, localestr.data(), localestr.size(),
299 &ink, &logical); 298 &ink, &logical);