add draw_get_align() to translate string to enum
This commit is contained in:
parent
aed3e569de
commit
6c7b0304a0
11
draw.c
11
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
|
||||
|
|
1
draw.h
1
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
|
||||
|
|
Loading…
Reference in New Issue