draw.c
changeset 617 ae5c3e06f7e2
parent 614 9ae187cb9ea8
child 618 567d70d132fa
equal deleted inserted replaced
616:f617c75a8405 617:ae5c3e06f7e2
   165 	return color.pixel;
   165 	return color.pixel;
   166 }
   166 }
   167 
   167 
   168 void
   168 void
   169 setfont(const char *fontstr) {
   169 setfont(const char *fontstr) {
   170 	char **missing, *def;
   170 	char *def, *lc, **missing;
   171 	int i, n;
   171 	int i, n;
   172 
   172 
   173 	setlocale(LC_CTYPE, "");
   173 	lc = setlocale(LC_CTYPE, NULL);
       
   174 	setlocale(LC_CTYPE, "UTF-8");
   174 	missing = NULL;
   175 	missing = NULL;
   175 	if(dc.font.set)
   176 	if(dc.font.set)
   176 		XFreeFontSet(dpy, dc.font.set);
   177 		XFreeFontSet(dpy, dc.font.set);
   177 	dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
   178 	dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
       
   179 	setlocale(LC_CTYPE, lc);
   178 	if(missing) {
   180 	if(missing) {
   179 		while(n--)
   181 		while(n--)
   180 			fprintf(stderr, "missing fontset: %s\n", missing[n]);
   182 			fprintf(stderr, "missing fontset: %s\n", missing[n]);
   181 		XFreeStringList(missing);
   183 		XFreeStringList(missing);
   182 	}
   184 	}