From 95b92d6cff9ec7bd42e37e408f50e06b36679739 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sun, 29 Nov 2009 19:42:29 +0100 Subject: [PATCH] new_font: convert to common signature --- src/conky.c | 2 +- src/specials.c | 19 ++++++++++--------- src/specials.h | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/conky.c b/src/conky.c index b9d032bf..6a4eae38 100644 --- a/src/conky.c +++ b/src/conky.c @@ -791,7 +791,7 @@ void generate_text_internal(char *p, int p_max_size, NORM_ERR("not implemented obj type %d", obj->type); #ifdef X11 OBJ(font) { - new_font(p, obj->data.s); + new_font(obj, p, p_max_size); } #endif /* X11 */ OBJ(text) { diff --git a/src/specials.c b/src/specials.c index 34a85313..c32cb9a5 100644 --- a/src/specials.c +++ b/src/specials.c @@ -284,24 +284,25 @@ void new_gauge(struct text_object *obj, char *p, int p_max_size, int usage) } #ifdef X11 -void new_font(char *buf, char *args) +void new_font(struct text_object *obj, char *p, int p_max_size) { + struct special_t *s; + int tmp = selected_font; + if ((output_methods & TO_X) == 0) return; - if (args) { - struct special_t *s = new_special(buf, FONT); + if (!p_max_size) + return; - if (s->font_added > font_count || !s->font_added || (strncmp(args, fonts[s->font_added].name, DEFAULT_TEXT_BUFFER_SIZE) != EQUAL) ) { - int tmp = selected_font; + s = new_special(p, FONT); - selected_font = s->font_added = add_font(args); + if (obj->data.s) { + if (s->font_added > font_count || !s->font_added || (strncmp(obj->data.s, fonts[s->font_added].name, DEFAULT_TEXT_BUFFER_SIZE) != EQUAL) ) { + selected_font = s->font_added = add_font(obj->data.s); selected_font = tmp; } } else { - struct special_t *s = new_special(buf, FONT); - int tmp = selected_font; - selected_font = s->font_added = 0; selected_font = tmp; } diff --git a/src/specials.h b/src/specials.h index fe001536..4f81164e 100644 --- a/src/specials.h +++ b/src/specials.h @@ -103,7 +103,7 @@ void scan_tab(struct text_object *, const char *); void scan_stippled_hr(struct text_object *, const char*); /* printing specials */ -void new_font(char *, char *); +void new_font(struct text_object *, char *, int); void new_graph(struct text_object *, char *, int, double); void new_hr(struct text_object *, char *, int); void new_stippled_hr(struct text_object *, char *, int);