summaryrefslogtreecommitdiffstats
path: root/drw.h
diff options
context:
space:
mode:
authorEric Pruitt <eric.pruitt@gmail.com>2015-03-05 20:26:11 -0800
committerAnselm R Garbe <garbeam@gmail.com>2015-03-13 21:44:22 +0100
commit14343e69cc596b847f71f1e825d3019ab1a29aa8 (patch)
treebf7b0bede9b451f7f8e78e0d47fda511201622d8 /drw.h
parentremoved .hgtags, thanks Dimitris for spotting (diff)
downloaddwm-14343e69cc596b847f71f1e825d3019ab1a29aa8.tar.gz
dwm-14343e69cc596b847f71f1e825d3019ab1a29aa8.zip
Add Xft and follback-fonts support to graphics lib
Diffstat (limited to 'drw.h')
-rw-r--r--drw.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/drw.h b/drw.h
index a5f34e0..536171b 100644
--- a/drw.h
+++ b/drw.h
@@ -1,7 +1,9 @@
1/* See LICENSE file for copyright and license details. */ 1/* See LICENSE file for copyright and license details. */
2#define DRW_FONT_CACHE_SIZE 32
2 3
3typedef struct { 4typedef struct {
4 unsigned long rgb; 5 unsigned long pix;
6 XftColor rgb;
5} Clr; 7} Clr;
6 8
7typedef struct { 9typedef struct {
@@ -9,11 +11,12 @@ typedef struct {
9} Cur; 11} Cur;
10 12
11typedef struct { 13typedef struct {
14 Display *dpy;
12 int ascent; 15 int ascent;
13 int descent; 16 int descent;
14 unsigned int h; 17 unsigned int h;
15 XFontSet set; 18 XftFont *xfont;
16 XFontStruct *xfont; 19 FcPattern *pattern;
17} Fnt; 20} Fnt;
18 21
19typedef struct { 22typedef struct {
@@ -30,7 +33,8 @@ typedef struct {
30 Drawable drawable; 33 Drawable drawable;
31 GC gc; 34 GC gc;
32 ClrScheme *scheme; 35 ClrScheme *scheme;
33 Fnt *font; 36 size_t fontcount;
37 Fnt *fonts[DRW_FONT_CACHE_SIZE];
34} Drw; 38} Drw;
35 39
36typedef struct { 40typedef struct {
@@ -44,8 +48,9 @@ void drw_resize(Drw *drw, unsigned int w, unsigned int h);
44void drw_free(Drw *drw); 48void drw_free(Drw *drw);
45 49
46/* Fnt abstraction */ 50/* Fnt abstraction */
47Fnt *drw_font_create(Display *dpy, const char *fontname); 51Fnt *drw_font_create(Drw *drw, const char *fontname);
48void drw_font_free(Display *dpy, Fnt *font); 52void drw_load_fonts(Drw* drw, const char *fonts[], size_t fontcount);
53void drw_font_free(Fnt *font);
49void drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *extnts); 54void drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *extnts);
50unsigned int drw_font_getexts_width(Fnt *font, const char *text, unsigned int len); 55unsigned int drw_font_getexts_width(Fnt *font, const char *text, unsigned int len);
51 56
@@ -63,7 +68,7 @@ void drw_setscheme(Drw *drw, ClrScheme *scheme);
63 68
64/* Drawing functions */ 69/* Drawing functions */
65void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert); 70void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert);
66void drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert); 71int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert);
67 72
68/* Map functions */ 73/* Map functions */
69void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 74void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);