From 1571bb1aad01d8a475d7022ce4a47740fe90149d Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Wed, 10 Jun 2009 14:08:39 -0600 Subject: [PATCH] Fix regression with loading of non-Xft fonts (sf.net #2804324). --- ChangeLog | 3 +++ src/conky.c | 1 + src/fonts.c | 15 +++++++++++++-- src/fonts.h | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3973494..a8c6166 100644 --- 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 diff --git a/src/conky.c b/src/conky.c index 98492b6..bad64f7 100644 --- a/src/conky.c +++ b/src/conky.c @@ -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 { diff --git a/src/fonts.c b/src/fonts.c index 67e363a..61c7b85 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -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"); diff --git a/src/fonts.h b/src/fonts.h index 5ff3d46..4853047 100644 --- a/src/fonts.h +++ b/src/fonts.h @@ -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); -- 1.7.9.5