Update copyright stuff, fix conky.conf weirdness.
[monky] / src / fonts.h
1 /* Conky, a system monitor, based on torsmo
2  *
3  * Any original torsmo code is licensed under the BSD license
4  *
5  * All code written since the fork of torsmo is licensed under the GPL
6  *
7  * Please see COPYING for details
8  *
9  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
10  * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
11  *      (see AUTHORS)
12  * All rights reserved.
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  * You should have received a copy of the GNU General Public License
24  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  *
26  */
27 #ifndef _FONTS_H
28 #define _FONTS_H
29
30 #include "x11.h"
31
32 /* for fonts */
33 struct font_list {
34
35         char name[DEFAULT_TEXT_BUFFER_SIZE];
36         int num;
37         XFontStruct *font;
38
39 #ifdef XFT
40         XftFont *xftfont;
41         int font_alpha;
42 #endif
43 };
44
45 #ifdef XFT
46
47 #define font_height() (use_xft ? (fonts[selected_font].xftfont->ascent + \
48         fonts[selected_font].xftfont->descent) \
49         : (fonts[selected_font].font->max_bounds.ascent + \
50         fonts[selected_font].font->max_bounds.descent))
51 #define font_ascent() (use_xft ? fonts[selected_font].xftfont->ascent \
52         : fonts[selected_font].font->max_bounds.ascent)
53 #define font_descent() (use_xft ? fonts[selected_font].xftfont->descent \
54         : fonts[selected_font].font->max_bounds.descent)
55
56 #else
57
58 #define font_height() (fonts[selected_font].font->max_bounds.ascent + \
59         fonts[selected_font].font->max_bounds.descent)
60 #define font_ascent() fonts[selected_font].font->max_bounds.ascent
61 #define font_descent() fonts[selected_font].font->max_bounds.descent
62
63 #endif
64
65 #define MAX_FONTS 64 // hmm, no particular reason, just makes sense.
66
67 /* direct access to registered fonts (FIXME: bad encapsulation) */
68 extern struct font_list *fonts;
69 extern int selected_font;
70 extern int font_count;
71
72 void set_font(void);
73 int addfont(const char *);
74 void set_first_font(const char *);
75 void free_fonts(void);
76 void load_fonts(void);
77
78 #endif /* _FONTS_H */