about summary refs log tree commit diff
path: root/xutil.c
diff options
context:
space:
mode:
authorokan <okan>2013-05-19 23:38:20 +0000
committerokan <okan>2013-05-19 23:38:20 +0000
commit5b4c55616a58c058cb1f3f80c4e04a24b8e824a3 (patch)
treee4f2b1bad1a859085f63bb4e742b35aec4bba1d7 /xutil.c
parente41c84c752c46b78c0996489e150515751ae8ac8 (diff)
downloadcwm-5b4c55616a58c058cb1f3f80c4e04a24b8e824a3.tar.gz
cwm-5b4c55616a58c058cb1f3f80c4e04a24b8e824a3.tar.xz
cwm-5b4c55616a58c058cb1f3f80c4e04a24b8e824a3.zip
move the 2 small font helper functions to xutil.c
Diffstat (limited to 'xutil.c')
-rw-r--r--xutil.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xutil.c b/xutil.c
index bcc7366..3e2b36c 100644
--- a/xutil.c
+++ b/xutil.c
@@ -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));
+}