Fix regression with loading of non-Xft fonts (sf.net #2804324).
authorBrenden Matthews <brenden@rty.ca>
Wed, 10 Jun 2009 20:08:39 +0000 (14:08 -0600)
committerBrenden Matthews <brenden@rty.ca>
Wed, 10 Jun 2009 20:08:39 +0000 (14:08 -0600)
ChangeLog
src/conky.c
src/fonts.c
src/fonts.h

index 3973494..a8c6166 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2009-06-10
+       * Fix regression with loading of non-Xft fonts (sf.net #2804324)
+
 2009-06-09
        * Fixed a regression which causes fonts to not be rendered properly with
        certain types of windows
index 98492b6..bad64f7 100644 (file)
@@ -6526,6 +6526,7 @@ static void draw_line(char *s)
 
                                        cur_y -= font_ascent();
                                        selected_font = specials[special_index].font_added;
+                                       set_font();
                                        if (cur_y + font_ascent() < cur_y + old) {
                                                cur_y += old;
                                        } else {
index 67e363a..61c7b85 100644 (file)
@@ -32,6 +32,16 @@ int selected_font = 0;
 int font_count = -1;
 struct font_list *fonts = NULL;
 
+void set_font(void)
+{
+#ifdef XFT
+       if (use_xft) return;
+#endif /* XFT */
+       if (font_count > -1 && fonts[selected_font].font) {
+               XSetFont(display, window.gc, fonts[selected_font].font->fid);
+       }
+}
+
 void setup_fonts(void)
 {
        if ((output_methods & TO_X) == 0) {
@@ -45,7 +55,8 @@ void setup_fonts(void)
                window.xftdraw = XftDrawCreate(display, window.drawable,
                                DefaultVisual(display, screen), DefaultColormap(display, screen));
        }
-#endif
+#endif /* XFT */
+       set_font();
 }
 
 int add_font(const char *data_in)
@@ -171,7 +182,7 @@ void load_fonts(void)
                }
 #endif
                /* load normal font */
-               if (fonts[i].font || (fonts[i].font = XLoadQueryFont(display, fonts[i].name)) == NULL) {
+               if (!fonts[i].font && (fonts[i].font = XLoadQueryFont(display, fonts[i].name)) == NULL) {
                        ERR("can't load font '%s'", fonts[i].name);
                        if ((fonts[i].font = XLoadQueryFont(display, "fixed")) == NULL) {
                                CRIT_ERR("can't load font '%s'", "fixed");
index 5ff3d46..4853047 100644 (file)
@@ -71,6 +71,7 @@ extern int selected_font;
 extern int font_count;
 
 void setup_fonts(void);
+void set_font(void);
 int add_font(const char *);
 void set_first_font(const char *);
 void free_fonts(void);