diff --git a/x.c b/x.c index a587996..2c43aa3 100644 --- a/x.c +++ b/x.c @@ -371,44 +371,6 @@ DC *initdc(void) return dc; } -void initfont(DC * dc, const char *fontstr) -{ - char *def, **missing, **names; - int i, n; - XFontStruct **xfonts; - - missing = NULL; - if ((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) { - dc->font.ascent = dc->font.xfont->ascent; - dc->font.descent = dc->font.xfont->descent; - dc->font.width = dc->font.xfont->max_bounds.width; - } else - if ((dc->font.set = - XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) { - n = XFontsOfFontSet(dc->font.set, &xfonts, &names); - for (i = 0; i < n; i++) { - dc->font.ascent = - MAX(dc->font.ascent, xfonts[i]->ascent); - dc->font.descent = - MAX(dc->font.descent, xfonts[i]->descent); - dc->font.width = - MAX(dc->font.width, xfonts[i]->max_bounds.width); - } - } else - if ((dc->font.xft_font = - XftFontOpenName(dc->dpy, DefaultScreen(dc->dpy), fontstr))) { - dc->font.ascent = dc->font.xft_font->ascent; - dc->font.descent = dc->font.xft_font->descent; - dc->font.width = dc->font.xft_font->max_advance_width; - } else { - eprintf("cannot load font '%s'\n", fontstr); - } - if (missing) - XFreeStringList(missing); - dc->font.height = dc->font.ascent + dc->font.descent; - return; -} - void setopacity(DC * dc, Window win, unsigned long opacity) { Atom _NET_WM_WINDOW_OPACITY = @@ -684,8 +646,6 @@ void x_setup(void) /* initialize xctx.dc, font, keyboard, colors */ xctx.dc = initdc(); - initfont(xctx.dc, settings.font); - x_shortcut_init(&settings.close_ks); x_shortcut_init(&settings.close_all_ks); x_shortcut_init(&settings.history_ks); diff --git a/x.h b/x.h index 4ddfea5..dbb7164 100644 --- a/x.h +++ b/x.h @@ -119,22 +119,13 @@ typedef struct _xctx { extern xctx_t xctx; -void drawrect(DC * dc, int x, int y, unsigned int w, unsigned int h, bool fill, - unsigned long color); -void drawtext(DC * dc, const char *text, ColorSet * col); -void drawtextn(DC * dc, const char *text, size_t n, ColorSet * col); void freecol(DC * dc, ColorSet * col); void eprintf(const char *fmt, ...); void freedc(DC * dc); unsigned long getcolor(DC * dc, const char *colstr); ColorSet *initcolor(DC * dc, const char *foreground, const char *background); DC *initdc(void); -void initfont(DC * dc, const char *fontstr); void setopacity(DC * dc, Window win, unsigned long opacity); -void mapdc(DC * dc, Window win, unsigned int w, unsigned int h); -void resizedc(DC * dc, unsigned int w, unsigned int h); -int textnw(DC * dc, const char *text, size_t len); -int textw(DC * dc, const char *text); /* window */ void x_win_draw(void);