#endif // HAVE_STDLIB_H
}
+#include <iostream>
+#include <algorithm>
+
#include "font.hh"
+#include "util.hh"
#include "display.hh"
#include "color.hh"
#include "screeninfo.hh"
void Font::drawString(XftDraw *d, int x, int y, const Color &color,
- const userstring &string) const
+ const ustring &string) const
{
assert(d);
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;
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);
}