diff options
Diffstat (limited to '')
| -rw-r--r-- | drw.h | 19 |
1 files changed, 12 insertions, 7 deletions
| @@ -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 | ||
| 3 | typedef struct { | 4 | typedef struct { |
| 4 | unsigned long rgb; | 5 | unsigned long pix; |
| 6 | XftColor rgb; | ||
| 5 | } Clr; | 7 | } Clr; |
| 6 | 8 | ||
| 7 | typedef struct { | 9 | typedef struct { |
| @@ -9,11 +11,12 @@ typedef struct { | |||
| 9 | } Cur; | 11 | } Cur; |
| 10 | 12 | ||
| 11 | typedef struct { | 13 | typedef 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 | ||
| 19 | typedef struct { | 22 | typedef 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 | ||
| 36 | typedef struct { | 40 | typedef struct { |
| @@ -44,8 +48,9 @@ void drw_resize(Drw *drw, unsigned int w, unsigned int h); | |||
| 44 | void drw_free(Drw *drw); | 48 | void drw_free(Drw *drw); |
| 45 | 49 | ||
| 46 | /* Fnt abstraction */ | 50 | /* Fnt abstraction */ |
| 47 | Fnt *drw_font_create(Display *dpy, const char *fontname); | 51 | Fnt *drw_font_create(Drw *drw, const char *fontname); |
| 48 | void drw_font_free(Display *dpy, Fnt *font); | 52 | void drw_load_fonts(Drw* drw, const char *fonts[], size_t fontcount); |
| 53 | void drw_font_free(Fnt *font); | ||
| 49 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *extnts); | 54 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *extnts); |
| 50 | unsigned int drw_font_getexts_width(Fnt *font, const char *text, unsigned int len); | 55 | unsigned 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 */ |
| 65 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert); | 70 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert); |
| 66 | void drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert); | 71 | int 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 */ |
| 69 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); | 74 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); |
