X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FFont.cc;h=fd7a0fbe3bb47111ca3aa650c53f62796f18a4a9;hb=2037631f753753a5c1ee9b2475b55658c3bb6eea;hp=d4a6950d247fda992b9dc6828c4b149bc2273b62;hpb=02c028d8ae0a80206eeb97c662cd3ceebf900977;p=chaz%2Fopenbox diff --git a/src/Font.cc b/src/Font.cc index d4a6950d..fd7a0fbe 100644 --- a/src/Font.cc +++ b/src/Font.cc @@ -267,23 +267,32 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, c.color.red = 0; c.color.green = 0; c.color.blue = 0; - c.color.alpha = 0x55 | 0x55 << 8; // transparent shadow + c.color.alpha = 0x40 | 0x40 << 8; // transparent shadow c.pixel = BlackPixel(_display, _screen->getScreenNumber()); - - XftDrawStringUtf8(draw, &c, _xftfont, x - 1, _xftfont->ascent + y + 1, - (XftChar8 *) string.c_str(), string.size()); +#ifdef XFT_UTF8 + XftDrawStringUtf8( +#else + XftDrawString8( +#endif + draw, &c, _xftfont, x + 1, _xftfont->ascent + y + 1, + (XftChar8 *) string.c_str(), string.size()); } - + XftColor c; c.color.red = color.red() | color.red() << 8; c.color.green = color.green() | color.green() << 8; c.color.blue = color.blue() | color.blue() << 8; - c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet c.pixel = color.pixel(); - - XftDrawStringUtf8(draw, &c, _xftfont, x, _xftfont->ascent + y, - (XftChar8 *) string.c_str(), string.size()); + c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet + +#ifdef XFT_UTF8 + XftDrawStringUtf8( +#else + XftDrawString8( +#endif + draw, &c, _xftfont, x, _xftfont->ascent + y, + (XftChar8 *) string.c_str(), string.size()); XftDrawDestroy(draw); return; @@ -309,9 +318,16 @@ unsigned int BFont::measureString(const string &string) const { #ifdef XFT if (_xftfont) { XGlyphInfo info; - XftTextExtentsUtf8(_display, _xftfont, (XftChar8 *) string.c_str(), - string.size(), &info); - return info.xOff; + +#ifdef XFT_UTF8 + XftTextExtentsUtf8( +#else + XftTextExtents8( +#endif + _display, _xftfont, (XftChar8 *) string.c_str(), + string.size(), &info); + + return info.xOff + (_shadow ? 1 : 0); } #endif // XFT @@ -330,7 +346,7 @@ unsigned int BFont::height(void) const { #ifdef XFT if (_xftfont) - return _xftfont->height; + return _xftfont->height + (_shadow ? 1 : 0); #endif // XFT if (i18n.multibyte())