X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ffont.cc;h=b9cc7075ce9c4c8f87a52f856635071c7fa01b5d;hb=8b73f6f02517e717842d122d82e1eb08cda95e19;hp=6932971c1c3ca6c9cb83d8793d1b3616a7dcdf12;hpb=74061b4e2d33d7e2101c4edda26cfc2a1294f32b;p=chaz%2Fopenbox diff --git a/otk/font.cc b/otk/font.cc index 6932971c..b9cc7075 100644 --- a/otk/font.cc +++ b/otk/font.cc @@ -10,7 +10,11 @@ extern "C" { #endif // HAVE_STDLIB_H } +#include +#include + #include "font.hh" +#include "util.hh" #include "display.hh" #include "color.hh" #include "screeninfo.hh" @@ -78,7 +82,7 @@ Font::~Font(void) void Font::drawString(XftDraw *d, int x, int y, const Color &color, - const userstring &string) const + const ustring &string) const { assert(d); @@ -90,14 +94,9 @@ 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()) - XftDrawStringUtf8(d, &c, _xftfont, x + _offset, - _xftfont->ascent + y + _offset, - (FcChar8*)string.c_str(), string.size()); - else - XftDrawString8(d, &c, _xftfont, x + _offset, - _xftfont->ascent + y + _offset, - (FcChar8*)string.c_str(), string.size()); + XftDrawStringUtf8(d, &c, _xftfont, x + _offset, + _xftfont->ascent + y + _offset, + (FcChar8*)string.c_str(), string.size()); } XftColor c; @@ -107,27 +106,19 @@ 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()) - XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y, - (FcChar8*)string.c_str(), string.size()); - else - XftDrawString8(d, &c, _xftfont, x, _xftfont->ascent + y, - (FcChar8*)string.c_str(), string.size()); + XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y, + (FcChar8*)string.c_str(), string.size()); return; } -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, - (FcChar8*)string.c_str(), string.size(), &info); - else - XftTextExtents8(Display::display, _xftfont, - (FcChar8*)string.c_str(), string.size(), &info); + XftTextExtentsUtf8(Display::display, _xftfont, + (FcChar8*)string.c_str(), string.size(), &info); return info.xOff + (_shadow ? _offset : 0); }