diff options
author | Connor Lane Smith <cls@lubutu.com> | 2010-06-30 01:36:15 +0100 |
---|---|---|
committer | Connor Lane Smith <cls@lubutu.com> | 2010-06-30 01:36:15 +0100 |
commit | 26b9f3de0ffe471e5335b07454147457e373c037 (patch) | |
tree | 5480fedbc318d490a4e90c2104d6ba8c26258698 /draw/initfont.c | |
parent | 7afd296c40a2e8af9477add1c3d02a7c4b444747 (diff) |
libdraw now has own repo
Diffstat (limited to 'draw/initfont.c')
-rw-r--r-- | draw/initfont.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/draw/initfont.c b/draw/initfont.c deleted file mode 100644 index 77d3182..0000000 --- a/draw/initfont.c +++ /dev/null @@ -1,36 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#include <X11/Xlib.h> -#include "draw.h" - -#define MAX(a, b) ((a) > (b) ? (a) : (b)) - -void -initfont(DC *dc, const char *fontstr) { - char *def, **missing = NULL; - int i, n; - - if(!fontstr || !*fontstr) - eprint("cannot load null font\n"); - dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def); - if(missing) - XFreeStringList(missing); - if(dc->font.set) { - XFontStruct **xfonts; - char **font_names; - dc->font.ascent = dc->font.descent = 0; - n = XFontsOfFontSet(dc->font.set, &xfonts, &font_names); - for(i = 0; i < n; i++) { - dc->font.ascent = MAX(dc->font.ascent, (*xfonts)->ascent); - dc->font.descent = MAX(dc->font.descent, (*xfonts)->descent); - xfonts++; - } - } - else { - if(!(dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr)) - && !(dc->font.xfont = XLoadQueryFont(dc->dpy, "fixed"))) - eprint("cannot load font '%s'\n", fontstr); - dc->font.ascent = dc->font.xfont->ascent; - dc->font.descent = dc->font.xfont->descent; - } - dc->font.height = dc->font.ascent + dc->font.descent; -} |