font.c
changeset 9 d567f430a81d
parent 2 a79188fe4a40
equal deleted inserted replaced
8:7066ff2fe8bc 9:d567f430a81d
    36 	if(font->set)
    36 	if(font->set)
    37 		XFreeFontSet(blitz->dpy, font->set);
    37 		XFreeFontSet(blitz->dpy, font->set);
    38 	font->set = XCreateFontSet(blitz->dpy, fontname, &missing, &n, &def);
    38 	font->set = XCreateFontSet(blitz->dpy, fontname, &missing, &n, &def);
    39 	if(missing) {
    39 	if(missing) {
    40 		while(n--)
    40 		while(n--)
    41 			fprintf(stderr, "liblitz: missing fontset: %s\n", missing[n]);
    41 			fprintf(stderr, "missing fontset: %s\n", missing[n]);
    42 		XFreeStringList(missing);
    42 		XFreeStringList(missing);
    43 		if(font->set) {
    43 		if(font->set) {
    44 			XFreeFontSet(blitz->dpy, font->set);
    44 			XFreeFontSet(blitz->dpy, font->set);
    45 			font->set = nil;
    45 			font->set = nil;
    46 		}
    46 		}
    70 		if (!font->xfont) {
    70 		if (!font->xfont) {
    71 			fontname = "fixed";
    71 			fontname = "fixed";
    72 			font->xfont = XLoadQueryFont(blitz->dpy, fontname);
    72 			font->xfont = XLoadQueryFont(blitz->dpy, fontname);
    73 		}
    73 		}
    74 		if (!font->xfont) {
    74 		if (!font->xfont) {
    75 			fprintf(stderr, "%s", "liblitz: error, cannot load 'fixed' font\n");
    75 			fprintf(stderr, "%s", "error, cannot load 'fixed' font\n");
    76 			exit(1);
    76 			exit(1);
    77 		}
    77 		}
    78 		font->ascent = font->xfont->ascent;
    78 		font->ascent = font->xfont->ascent;
    79 		font->descent = font->xfont->descent;
    79 		font->descent = font->xfont->descent;
    80 	}
    80 	}