]> Dogcows Code - chaz/openbox/blobdiff - src/Font.cc
Allow for customizing of the dropShadows.
[chaz/openbox] / src / Font.cc
index ae835e7607ae2cabf18d5146114a84278a911a0e..e2649f10ae3e056ac7609e233cff365ef6e37b07 100644 (file)
@@ -48,7 +48,8 @@ string      BFont::_fallback_font   = "fixed";
 
 #ifdef XFT
 BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
-             bool bold, bool italic, bool shadow, bool antialias) :
+             bool bold, bool italic, bool shadow, unsigned char offset, 
+             unsigned char tint, bool antialias) :
                                           _display(d),
                                           _screen(screen),
                                           _family(family),
@@ -58,6 +59,8 @@ BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
                                           _italic(italic),
                                           _antialias(antialias),
                                           _shadow(shadow),
+                                          _offset(offset),
+                                          _tint(tint),
                                           _xftfont(0),
                                           _font(0),
                                           _fontset(0),
@@ -267,12 +270,17 @@ 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 = 0x49 | 0x49 << 8; // transparent shadow
+      c.color.alpha = _tint | _tint << 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 + _offset, 
+                     _xftfont->ascent + y + _offset, (XftChar8 *) string.c_str(), 
+                     string.size());
     }
     
     XftColor c;
@@ -282,8 +290,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 +322,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
This page took 0.024743 seconds and 4 git commands to generate.