conky/conky-1.7.1.1-nonxft.patch
2009-06-17 11:56:56 +00:00

82 lines
2.3 KiB
Diff

commit 1571bb1aad01d8a475d7022ce4a47740fe90149d
Author: Brenden Matthews <brenden@rty.ca>
Date: Wed Jun 10 14:08:39 2009 -0600
Fix regression with loading of non-Xft fonts (sf.net #2804324).
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);