From: Marius Nita Date: Tue, 24 Sep 2002 05:06:14 +0000 (+0000) Subject: Fix XFT-UTF8 build issue X-Git-Tag: openbox-2_1_2^3~6 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=f9ea9ca333f37648e88b019169eb3a6d89ff446c;p=dana%2Fopenbox.git Fix XFT-UTF8 build issue --- diff --git a/src/Font.cc b/src/Font.cc index 68114a98..fd7a0fbe 100644 --- a/src/Font.cc +++ b/src/Font.cc @@ -270,9 +270,13 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, 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; @@ -282,8 +286,13 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, c.pixel = color.pixel(); c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet - XftDrawStringUtf8(draw, &c, _xftfont, x, _xftfont->ascent + y, - (XftChar8 *) string.c_str(), string.size()); +#ifdef XFT_UTF8 + XftDrawStringUtf8( +#else + XftDrawString8( +#endif + draw, &c, _xftfont, x, _xftfont->ascent + y, + (XftChar8 *) string.c_str(), string.size()); XftDrawDestroy(draw); return; @@ -309,8 +318,15 @@ unsigned int BFont::measureString(const string &string) const { #ifdef XFT if (_xftfont) { XGlyphInfo info; - XftTextExtentsUtf8(_display, _xftfont, (XftChar8 *) string.c_str(), - string.size(), &info); + +#ifdef XFT_UTF8 + XftTextExtentsUtf8( +#else + XftTextExtents8( +#endif + _display, _xftfont, (XftChar8 *) string.c_str(), + string.size(), &info); + return info.xOff + (_shadow ? 1 : 0); } #endif // XFT diff --git a/util/xftlsfonts.cc b/util/xftlsfonts.cc index bd2313fe..d02758e2 100644 --- a/util/xftlsfonts.cc +++ b/util/xftlsfonts.cc @@ -128,12 +128,14 @@ int main(int argc, char **argv) { cout << val.u.b; break; +#ifdef XFT_UTF8 case XftTypeMatrix: cout << "xx(" << val.u.m->xx << ") "; cout << "xy(" << val.u.m->xy << ") "; cout << "yx(" << val.u.m->yx << ") "; cout << "yy(" << val.u.m->yy << ")"; break; +#endif } } while ((vallist = vallist->next)); cout << endl;