From: Connor Lane Smith Date: Sat, 21 May 2011 19:26:26 +0000 (+0100) Subject: update draw.c X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=04797343db457578906355cf1118548be90a183e;p=dwm.git update draw.c --- diff --git a/draw.c b/draw.c index 341a26f..2028fd9 100644 --- a/draw.c +++ b/draw.c @@ -126,13 +126,13 @@ loadfont(DC *dc, const char *fontstr) { if(!*fontstr) return False; - if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) { + if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) n = XFontsOfFontSet(dc->font.set, &xfonts, &names); - } - else { - dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr); + else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) xfonts = &dc->font.xfont; - } + else + n = 0; + 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);