[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: disappearing title bar text, switching screens
On Tue, Oct 16, 2007 at 02:20:03AM +0300, Nikos Ntarmos wrote:
> @@ -57,17 +69,17 @@ drawtext(Display *disp, int screen, int x, int y, int w, int h, Drawable drawabl
> if(len > 3)
> buf[len - 3] = '.';
> }
> - xrcolor.red = color[ColFG].red;
> - xrcolor.green = color[ColFG].green;
> - xrcolor.blue = color[ColFG].blue;
> - XftColorAllocValue(disp, DefaultVisual(disp, screen), DefaultColormap(disp, screen), &xrcolor, &xftcolor);
> - xftdrawable = XftDrawCreate(disp, drawable, DefaultVisual(disp, screen), DefaultColormap(disp, screen));
> - XftDrawStringUtf8(xftdrawable, &xftcolor, font,
> - x + (font->height / 2),
> - y + (h / 2) - (font->height / 2) + font->ascent,
> - (XftChar8 *) buf, len);
> - XftColorFree(disp, DefaultVisual(disp, screen), DefaultColormap(disp, screen), &xftcolor);
> - XftDrawDestroy(xftdrawable);
> +
> + cairo_font_extents(cr, &fe);
> + cairo_text_extents(cr, buf, &te);
> + realx = font->height / 2 + x;
> + realy = y + fe.height - fe.descent;
You can also use:
realy = y + 2 * fe.height - fe.descent - fe.ascent;
I think that with this the text is better centered vertically in the
statusbar, but I can't trust my blurry eyes on this any more...
Cheers.
\n\n
--
To unsubscribe, send mail to awesome-unsubscribe@xxxxxxxxxxxxx