X-Git-Url: https://git.danieliu.xyz/?p=dwm.git;a=blobdiff_plain;f=drw.h;h=536171b958b939b06c9bbf9008806ffb2a8d205a;hp=a5f34e0ac96c962f87f9df52dc50fe5aa28a8a78;hb=14343e69cc596b847f71f1e825d3019ab1a29aa8;hpb=35db6d8afc3fd9f80166feac6c1e4adf71d553c3 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);