move the 2 small font helper functions to xutil.c

This commit is contained in:
okan
2013-05-19 23:38:20 +00:00
parent e41c84c752
commit 5b4c55616a
6 changed files with 32 additions and 63 deletions

20
xutil.c
View File

@@ -429,3 +429,23 @@ xu_xorcolor(XftColor a, XftColor b, XftColor *r)
r->color.blue = a.color.blue ^ b.color.blue;
r->color.alpha = 0xffff;
}
int
xu_xft_width(XftFont *xftfont, const char *text, int len)
{
XGlyphInfo extents;
XftTextExtentsUtf8(X_Dpy, xftfont, (const FcChar8*)text,
len, &extents);
return (extents.xOff);
}
void
xu_xft_draw(struct screen_ctx *sc, const char *text,
Drawable d, int color, int x, int y)
{
XftDrawChange(sc->xftdraw, d);
XftDrawStringUtf8(sc->xftdraw, &sc->xftcolor[color], sc->xftfont,
x, y, (const FcChar8*)text, strlen(text));
}