From 6c7b0304a059de745d317bafd18026ea80a23713 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 3 Jan 2008 16:02:32 +0100 Subject: [PATCH] add draw_get_align() to translate string to enum --- draw.c | 11 +++++++++++ draw.h | 1 + 2 files changed, 12 insertions(+) diff --git a/draw.c b/draw.c index 687c89f6..9368125c 100644 --- a/draw.c +++ b/draw.c @@ -307,4 +307,15 @@ textwidth(XftFont *font, char *text) return MAX(te.x_advance, te.width); } +int +draw_get_align(const char *align) +{ + if(!a_strncmp(align, "center", 6)) + return AlignCenter; + else if(!a_strncmp(align, "right", 5)) + return AlignRight; + + return AlignLeft; +} + // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/draw.h b/draw.h index ba9d7d8a..85b96cb9 100644 --- a/draw.h +++ b/draw.h @@ -56,6 +56,7 @@ void draw_image_from_argb_data(DrawCtx *, int, int, int, int, int, unsigned char Area draw_get_image_size(const char *filename); Drawable draw_rotate(DrawCtx *, int, double, int, int); unsigned short textwidth(XftFont *, char *); +int draw_get_align(const char *); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80