diff options
author | Eric Pruitt | 2015-03-05 20:26:11 -0800 |
---|---|---|
committer | Anselm R Garbe | 2015-03-13 21:44:22 +0100 |
commit | a8140d03d89bc474d9f24bff9db7ba7fc5987197 (patch) | |
tree | 67cc97d48c12c3a2930ae7d8a6db3aa2cb45cbd7 /drw.h | |
parent | 561b92e6aa85e495a1f22224364b4866c49e5fc7 (diff) | |
download | aur-a8140d03d89bc474d9f24bff9db7ba7fc5987197.tar.gz |
Add Xft and follback-fonts support to graphics lib
Diffstat (limited to 'drw.h')
-rw-r--r-- | drw.h | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -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); |