fixed font bug
authorBrenden Matthews <brenden1@rty.ca>
Sun, 28 May 2006 04:25:34 +0000 (04:25 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Sun, 28 May 2006 04:25:34 +0000 (04:25 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@662 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
src/conky.c

index 7e61f76..3675cf7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 # $Id$
 
+2006-05-27
+       * Fixed a bug with $font
+
 2006-05-24
        * Xdamage support for composite and pals
 
index 2b85488..676ff74 100644 (file)
@@ -561,10 +561,6 @@ static char *scan_font(const char *args)
        if (args && sizeof(args) < 127) {
                return strdup(args);
        }
-/*     else {
-               ERR("font scan failed, lets hope it doesn't mess stuff up");
-               we'll assume this means to use the default font now, like $color
-       }*/
        return NULL;
 }
 
@@ -576,7 +572,6 @@ static void new_font(char *buf, char * args) {
                        int tmp = selected_font;
                        selected_font = s->font_added = addfont(args);
                        load_fonts();
-                       //set_font();
                        selected_font = tmp;
                }
        } else {
@@ -584,7 +579,6 @@ static void new_font(char *buf, char * args) {
                int tmp = selected_font;
                selected_font = s->font_added = 0;
                load_fonts();
-               //set_font();
                selected_font = tmp;
        }
 }
@@ -4822,7 +4816,7 @@ static void text_size_updater(char *s)
                                h += specials[special_index].arg;
                        }
                        else if (specials[special_index].type == FONT) {
-                               fontchange = specials[special_index].font_added;
+                               fontchange = 1;
                                selected_font = specials[special_index].font_added;
                                h = font_height();
                        }
@@ -5356,15 +5350,15 @@ static void draw_line(char *s)
                        
                                case FONT:
                                if (fontchange) {
+                                       int old = font_ascent();
                                        cur_y -= font_ascent();
                                        selected_font = specials[special_index].font_added;
-                                       cur_y += font_ascent();
-#ifdef XFT
-                                       if (!use_xft || use_xdbe)
-#endif
-                                       {
-                                               set_font();
+                                       if (cur_y + (font_ascent()) < old) {
+                                               cur_y = old;
+                                       } else {
+                                               cur_y += font_ascent();
                                        }
+                                       set_font();
                                }
                                break;
                        case FG: