Add Xft and follback-fonts support to graphics lib
This commit is contained in:
parent
35db6d8afc
commit
14343e69cc
6 changed files with 299 additions and 103 deletions
19
drw.h
19
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue