better fix for font height problem

Thanks to Arnaud Fontaine
This commit is contained in:
Julien Danjou 2007-10-04 17:35:47 +02:00
parent 2e0b2911e3
commit d7aac7b811
2 changed files with 3 additions and 3 deletions

2
draw.c
View File

@ -44,7 +44,7 @@ drawtext(Display *disp, int screen, DC *drawcontext, Drawable drawable, const ch
len = sizeof(buf) - 1; len = sizeof(buf) - 1;
memcpy(buf, text, len); memcpy(buf, text, len);
buf[len] = 0; buf[len] = 0;
h = drawcontext->font->ascent + drawcontext->font->descent; h = drawcontext->font->height;
y = drawcontext->y + (drawcontext->h / 2) - (h / 2) + drawcontext->font->ascent; y = drawcontext->y + (drawcontext->h / 2) - (h / 2) + drawcontext->font->ascent;
x = drawcontext->x + (h / 2); x = drawcontext->x + (h / 2);
while(len && (w = textwidth(disp, drawcontext->font, buf, len)) > drawcontext->w - h) while(len && (w = textwidth(disp, drawcontext->font, buf, len)) > drawcontext->w - h)

View File

@ -56,7 +56,7 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
drawcontext->x = drawcontext->y = 0; drawcontext->x = drawcontext->y = 0;
for(i = 0; i < awesomeconf->ntags; i++) for(i = 0; i < awesomeconf->ntags; i++)
{ {
drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->tags[i].name, a_strlen(awesomeconf->tags[i].name)) + drawcontext->font->height + 1; drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->tags[i].name, a_strlen(awesomeconf->tags[i].name)) + drawcontext->font->height;
if(awesomeconf->tags[i].selected) if(awesomeconf->tags[i].selected)
{ {
drawtext(disp, awesomeconf->phys_screen, drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i].name, drawcontext->sel, drawcontext->text_selected); drawtext(disp, awesomeconf->phys_screen, drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i].name, drawcontext->sel, drawcontext->text_selected);
@ -74,7 +74,7 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
drawcontext->w = awesomeconf->statusbar.width; drawcontext->w = awesomeconf->statusbar.width;
drawtext(disp, awesomeconf->phys_screen, drawcontext, awesomeconf->statusbar.drawable, awesomeconf->current_layout->symbol, drawcontext->norm, drawcontext->text_normal); drawtext(disp, awesomeconf->phys_screen, drawcontext, awesomeconf->statusbar.drawable, awesomeconf->current_layout->symbol, drawcontext->norm, drawcontext->text_normal);
x = drawcontext->x + drawcontext->w; x = drawcontext->x + drawcontext->w;
drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->statustext, a_strlen(awesomeconf->statustext)) + drawcontext->font->height + 1; drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->statustext, a_strlen(awesomeconf->statustext)) + drawcontext->font->height;
drawcontext->x = si[awesomeconf->screen].width - drawcontext->w; drawcontext->x = si[awesomeconf->screen].width - drawcontext->w;
if(drawcontext->x < x) if(drawcontext->x < x)
{ {