mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-16 07:47:22 +01:00
draw: fix text alignment on small width
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
35811f9c36
commit
00149a0e90
1 changed files with 13 additions and 11 deletions
24
draw.c
24
draw.c
|
@ -406,17 +406,19 @@ draw_text(draw_context_t *ctx, font_t *font, PangoEllipsizeMode ellip, PangoWrap
|
|||
* face */
|
||||
y = area.y + (ctx->height - ext.height + 1) / 2 + pdata->margin.top;
|
||||
|
||||
switch(pdata->align)
|
||||
{
|
||||
case AlignCenter:
|
||||
x += (area.width - ext.width) / 2;
|
||||
break;
|
||||
case AlignRight:
|
||||
x += area.width - ext.width;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* only honors alignment if enough space */
|
||||
if(ext.width < area.width)
|
||||
switch(pdata->align)
|
||||
{
|
||||
case AlignCenter:
|
||||
x += (area.width - ext.width) / 2;
|
||||
break;
|
||||
case AlignRight:
|
||||
x += area.width - ext.width;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(pdata->shadow.offset)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue