add draw_get_align() to translate string to enum

This commit is contained in:
Julien Danjou 2008-01-03 16:02:32 +01:00
parent aed3e569de
commit 6c7b0304a0
2 changed files with 12 additions and 0 deletions

11
draw.c
View File

@ -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

1
draw.h
View File

@ -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