-static void
-drawborder(Display *dpy, Brush *b)
-{
-       XPoint points[5];
-       XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter);
-       XSetForeground(dpy, b->gc, b->border);
-       points[0].x = b->x;
-       points[0].y = b->y;
-       points[1].x = b->w - 1;
-       points[1].y = 0;
-       points[2].x = 0;
-       points[2].y = b->h - 1;
-       points[3].x = -(b->w - 1);
-       points[3].y = 0;
-       points[4].x = 0;
-       points[4].y = -(b->h - 1);
-       XDrawLines(dpy, b->drawable, b->gc, points, 5, CoordModePrevious);
+       if(dc.font.set) {
+               XmbTextExtents(dc.font.set, text, len, NULL, &r);
+               return r.width;
+       }
+       return XTextWidth(dc.font.xfont, text, len);