aboutsummaryrefslogtreecommitdiffstats
path: root/drw.h
diff options
context:
space:
mode:
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 @@
/* See LICENSE file for copyright and license details. */
+#define DRW_FONT_CACHE_SIZE 32
typedef struct {
- unsigned long rgb;
+ unsigned long pix;
+ XftColor rgb;
} Clr;
typedef struct {
@@ -9,11 +11,12 @@ typedef struct {
} Cur;
typedef struct {
+ Display *dpy;
int ascent;
int descent;
unsigned int h;
- XFontSet set;
- XFontStruct *xfont;
+ XftFont *xfont;
+ FcPattern *pattern;
} Fnt;
typedef struct {
@@ -30,7 +33,8 @@ typedef struct {
Drawable drawable;
GC gc;
ClrScheme *scheme;
- Fnt *font;
+ size_t fontcount;
+ Fnt *fonts[DRW_FONT_CACHE_SIZE];
} Drw;
typedef struct {
@@ -44,8 +48,9 @@ void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
/* Fnt abstraction */
-Fnt *drw_font_create(Display *dpy, const char *fontname);
-void drw_font_free(Display *dpy, Fnt *font);
+Fnt *drw_font_create(Drw *drw, const char *fontname);
+void drw_load_fonts(Drw* drw, const char *fonts[], size_t fontcount);
+void drw_font_free(Fnt *font);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *extnts);
unsigned int drw_font_getexts_width(Fnt *font, const char *text, unsigned int len);
@@ -63,7 +68,7 @@ void drw_setscheme(Drw *drw, ClrScheme *scheme);
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert);
-void drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert);
+int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert);
/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
remember that computers suck.