]> Dogcows Code - chaz/openbox/blobdiff - otk/font.cc
set the ustring's utf type so that it matches what it appended to it
[chaz/openbox] / otk / font.cc
index 6932971c1c3ca6c9cb83d8793d1b3616a7dcdf12..a9f2fd3ee352e41220a7b49bfcd2e80a5e9e4edc 100644 (file)
@@ -10,7 +10,11 @@ extern "C" {
 #endif // HAVE_STDLIB_H
 }
 
+#include <iostream>
+#include <algorithm>
+
 #include "font.hh"
+#include "util.hh"
 #include "display.hh"
 #include "color.hh"
 #include "screeninfo.hh"
@@ -52,14 +56,14 @@ Font::Font(int screen_num, const std::string &fontstring,
     _xft_init = true;
   }
 
-  if ((_xftfont = XftFontOpenName(Display::display, _screen_num,
+  if ((_xftfont = XftFontOpenName(**display, _screen_num,
                                   _fontstring.c_str())))
     return;
 
   printf(_("Unable to load font: %s\n"), _fontstring.c_str());
   printf(_("Trying fallback font: %s\n"), _fallback_font.c_str());
 
-  if ((_xftfont = XftFontOpenName(Display::display, _screen_num,
+  if ((_xftfont = XftFontOpenName(**display, _screen_num,
                                   _fallback_font.c_str())))
     return;
 
@@ -73,12 +77,12 @@ Font::Font(int screen_num, const std::string &fontstring,
 Font::~Font(void)
 {
   if (_xftfont)
-    XftFontClose(Display::display, _xftfont);
+    XftFontClose(**display, _xftfont);
 }
 
 
 void Font::drawString(XftDraw *d, int x, int y, const Color &color,
-                       const userstring &string) const
+                       const ustring &string) const
 {
   assert(d);
 
@@ -88,7 +92,7 @@ void Font::drawString(XftDraw *d, int x, int y, const Color &color,
     c.color.green = 0;
     c.color.blue = 0;
     c.color.alpha = _tint | _tint << 8; // transparent shadow
-    c.pixel = BlackPixel(Display::display, _screen_num);
+    c.pixel = BlackPixel(**display, _screen_num);
 
     if (string.utf8())
       XftDrawStringUtf8(d, &c, _xftfont, x + _offset,
@@ -118,15 +122,15 @@ 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 ustring &string) const
 {
   XGlyphInfo info;
 
   if (string.utf8())
-    XftTextExtentsUtf8(Display::display, _xftfont,
+    XftTextExtentsUtf8(**display, _xftfont,
                        (FcChar8*)string.c_str(), string.size(), &info);
   else
-    XftTextExtents8(Display::display, _xftfont,
+    XftTextExtents8(**display, _xftfont,
                     (FcChar8*)string.c_str(), string.size(), &info);
 
   return info.xOff + (_shadow ? _offset : 0);
This page took 0.024554 seconds and 4 git commands to generate.