diff --git a/common/draw.c b/common/draw.c index 8446a1dfb..04f1ce32f 100644 --- a/common/draw.c +++ b/common/draw.c @@ -226,6 +226,8 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, case A_TK_IMAGE: data->bg_image = draw_image_new(*values); break; + case A_TK_ALIGN: + data->bg_align = draw_align_fromstr(*values, -1); default: break; } @@ -338,7 +340,20 @@ draw_text(draw_context_t *ctx, font_t *font, if(pdata->bg_image) { - draw_image(ctx, area.x, area.y, 0, pdata->bg_image); + x = area.x; + y = area.y; + switch(pdata->bg_align) + { + case AlignCenter: + x += (area.width - pdata->bg_image->width) / 2; + break; + case AlignRight: + x += area.width- pdata->bg_image->width; + break; + default: + break; + } + draw_image(ctx, x, y, 0, pdata->bg_image); draw_image_delete(&pdata->bg_image); } diff --git a/common/draw.h b/common/draw.h index 71b08c170..41ed673e2 100644 --- a/common/draw.h +++ b/common/draw.h @@ -167,6 +167,7 @@ typedef struct bool has_bg_color; xcolor_t bg_color; draw_image_t *bg_image; + alignment_t bg_align; struct { int offset;