aboutsummaryrefslogtreecommitdiffstats
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
parent35db6d8afc3fd9f80166feac6c1e4adf71d553c3 (diff)
downloaddwm-14343e69cc596b847f71f1e825d3019ab1a29aa8.tar.gz
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 @@
/* 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);