changeset: 21:c348a5e7bfd7
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Fri Aug 27 20:32:35 2010 +0100
files: font.c
description:
font fix
diff -r ea5665a88106 -r c348a5e7bfd7 font.c
--- a/font.c Thu Aug 19 16:43:29 2010 +0100
+++ b/font.c Fri Aug 27 20:32:35 2010 +0100
@@ -20,26 +20,26 @@
Bool
loadfont(DC *dc, const char *fontstr) {
+ char *def, **missing;
+ int i, n;
+
if(!*fontstr)
return False;
- if(XSupportsLocale()) {
- char *def, **missing, **names;
- int i, n;
+ if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
+ char **names;
XFontStruct **xfonts;
- if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
- n = XFontsOfFontSet(dc->font.set, &xfonts, &names);
- for(i = dc->font.ascent = dc->font.descent = 0; i < n; i++) {
- dc->font.ascent = MAX(dc->font.ascent, xfonts[i]->ascent);
- dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent);
- }
+ n = XFontsOfFontSet(dc->font.set, &xfonts, &names);
+ for(i = dc->font.ascent = dc->font.descent = 0; i < n; i++) {
+ dc->font.ascent = MAX(dc->font.ascent, xfonts[i]->ascent);
+ dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent);
}
- if(missing)
- XFreeStringList(missing);
}
else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
dc->font.ascent = dc->font.xfont->ascent;
dc->font.descent = dc->font.xfont->descent;
}
- return (dc->font.set != NULL || dc->font.xfont != NULL);
+ if(missing)
+ XFreeStringList(missing);
+ return (dc->font.set || dc->font.xfont);
}
Received on Fri Aug 27 2010 - 21:32:41 CEST
This archive was generated by hypermail 2.2.0 : Fri Aug 27 2010 - 21:36:04 CEST