From 9a5e74511404434349cbc6877ba8ecb8456e0e74 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 30 Dec 2007 14:22:19 +0100 Subject: [PATCH] remove textwidth_primitive --- draw.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/draw.c b/draw.c index 43fd03f9..07959c58 100644 --- a/draw.c +++ b/draw.c @@ -247,14 +247,17 @@ draw_rotate(DrawCtx *ctx, int screen, double angle, int tx, int ty) return newdrawable; } -static unsigned short -textwidth_primitive(XftFont *font, char *text) +unsigned short +textwidth(XftFont *font, char *text) { cairo_surface_t *surface; cairo_t *cr; cairo_font_face_t *font_face; cairo_text_extents_t te; + if (!a_strlen(text)) + return 0; + surface = cairo_xlib_surface_create(globalconf.display, DefaultScreen(globalconf.display), DefaultVisual(globalconf.display, DefaultScreen(globalconf.display)), DisplayWidth(globalconf.display, DefaultScreen(globalconf.display)), @@ -271,12 +274,4 @@ textwidth_primitive(XftFont *font, char *text) return MAX(te.x_advance, te.width) + font->height; } -unsigned short -textwidth(XftFont *font, char *text) -{ - if (!a_strlen(text)) - return 0; - return textwidth_primitive(font, text); -} - // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80