]> Dogcows Code - chaz/openbox/blobdiff - otk/font.cc
remove userstring
[chaz/openbox] / otk / font.cc
index 6932971c1c3ca6c9cb83d8793d1b3616a7dcdf12..0f1ad8c1cb5559d20647e21df54db7c4dead0ef8 100644 (file)
@@ -10,7 +10,15 @@ extern "C" {
 #endif // HAVE_STDLIB_H
 }
 
+#include <iostream>
+#include <algorithm>
+
+using std::string;
+using std::cerr;
+using std::endl;
+
 #include "font.hh"
+#include "util.hh"
 #include "display.hh"
 #include "color.hh"
 #include "screeninfo.hh"
@@ -26,10 +34,10 @@ extern "C" {
 
 namespace otk {
 
-std::string Font::_fallback_font = "fixed";
+string      Font::_fallback_font = "fixed";
 bool        Font::_xft_init      = false;
 
-Font::Font(int screen_num, const std::string &fontstring,
+Font::Font(int screen_num, const string &fontstring,
              bool shadow, unsigned char offset, unsigned char tint)
   : _screen_num(screen_num),
     _fontstring(fontstring),
@@ -78,7 +86,7 @@ Font::~Font(void)
 
 
 void Font::drawString(XftDraw *d, int x, int y, const Color &color,
-                       const userstring &string) const
+                       const string &string, bool utf8) const
 {
   assert(d);
 
@@ -90,7 +98,7 @@ void Font::drawString(XftDraw *d, int x, int y, const Color &color,
     c.color.alpha = _tint | _tint << 8; // transparent shadow
     c.pixel = BlackPixel(Display::display, _screen_num);
 
-    if (string.utf8())
+    if (utf8)
       XftDrawStringUtf8(d, &c, _xftfont, x + _offset,
                         _xftfont->ascent + y + _offset,
                         (FcChar8*)string.c_str(), string.size());
@@ -107,7 +115,7 @@ void Font::drawString(XftDraw *d, int x, int y, const Color &color,
   c.pixel = color.pixel();
   c.color.alpha = 0xff | 0xff << 8; // no transparency in Color yet
 
-  if (string.utf8())
+  if (utf8)
     XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y,
                       (FcChar8*)string.c_str(), string.size());
   else
@@ -118,11 +126,11 @@ void Font::drawString(XftDraw *d, int x, int y, const Color &color,
 }
 
 
-unsigned int Font::measureString(const userstring &string) const
+unsigned int Font::measureString(const string &string, bool utf8) const
 {
   XGlyphInfo info;
 
-  if (string.utf8())
+  if (utf8)
     XftTextExtentsUtf8(Display::display, _xftfont,
                        (FcChar8*)string.c_str(), string.size(), &info);
   else
This page took 0.024835 seconds and 4 git commands to generate.