draw.c
changeset 619 bda4880c462d
parent 618 567d70d132fa
child 626 2644c951fc74
equal deleted inserted replaced
618:567d70d132fa 619:bda4880c462d
     1 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
     1 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
     2  * See LICENSE file for license details.
     2  * See LICENSE file for license details.
     3  */
     3  */
     4 #include "dwm.h"
     4 #include "dwm.h"
     5 #include <locale.h>
       
     6 #include <stdio.h>
     5 #include <stdio.h>
     7 #include <string.h>
     6 #include <string.h>
     8 
     7 
     9 /* static */
     8 /* static */
    10 
     9 
   165 	return color.pixel;
   164 	return color.pixel;
   166 }
   165 }
   167 
   166 
   168 void
   167 void
   169 setfont(const char *fontstr) {
   168 setfont(const char *fontstr) {
   170 	char *def, *lc, **missing;
   169 	char *def, **missing;
   171 	int i, n;
   170 	int i, n;
   172 
   171 
   173 	lc = setlocale(LC_CTYPE, NULL);
       
   174 	setlocale(LC_CTYPE, "UTF-8");
       
   175 	missing = NULL;
   172 	missing = NULL;
   176 	if(dc.font.set)
   173 	if(dc.font.set)
   177 		XFreeFontSet(dpy, dc.font.set);
   174 		XFreeFontSet(dpy, dc.font.set);
   178 	dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
   175 	dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
   179 	setlocale(LC_CTYPE, lc);
       
   180 	if(missing) {
   176 	if(missing) {
   181 		while(n--)
   177 		while(n--)
   182 			fprintf(stderr, "missing fontset: %s\n", missing[n]);
   178 			fprintf(stderr, "missing fontset: %s\n", missing[n]);
   183 		XFreeStringList(missing);
   179 		XFreeStringList(missing);
   184 	}
   180 	}