summaryrefslogtreecommitdiff
path: root/xc
diff options
context:
space:
mode:
authorconverse <empty>1995-06-02 23:29:17 +0000
committerconverse <empty>1995-06-02 23:29:17 +0000
commit572384e98464f65bf0ceacac137dfe02918228b3 (patch)
tree88fcca4670c842aee4f977317c5689dedbc70446 /xc
parentcabb136896f7aaedbdeda33e5a984c9917388129 (diff)
in check_fontname, which is called as part of constructing a
fontset, write equivalent code which makes fewer queries of font information, and fewer calls to get atom names. This reduces the number of fonts that have to be opened by the server. Apparently the change between R5 and R6 in creating fontsets needs this optimization. Be careful to free memory appropriately. See #6985
Diffstat (limited to 'xc')
-rw-r--r--xc/lib/X11/omGeneric.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/xc/lib/X11/omGeneric.c b/xc/lib/X11/omGeneric.c
index f1846bd74..66dc145ca 100644
--- a/xc/lib/X11/omGeneric.c
+++ b/xc/lib/X11/omGeneric.c
@@ -1,4 +1,4 @@
-/* $XConsortium: omGeneric.c,v 1.6 94/03/29 22:52:12 rws Exp kaleb $ */
+/* $XConsortium: omGeneric.c,v 1.7 95/02/22 22:48:22 kaleb Exp converse $ */
/*
* Copyright 1992, 1993 by TOSHIBA Corp.
*
@@ -125,16 +125,17 @@ check_fontname(oc, name, found_num)
FontData data;
FontSet font_set;
XFontStruct *fs_list;
- char **fn_list, *fname, *prop_fname;
+ char **fn_list, *fname, *prop_fname = NULL;
int list_num, font_set_num, i;
+ int list2_num;
+ char **fn2_list = NULL;
- fn_list = XListFontsWithInfo(dpy, name, MAXFONTS, &list_num, &fs_list);
+ fn_list = XListFonts(dpy, name, MAXFONTS, &list_num);
if (fn_list == NULL)
return found_num;
for (i = 0; i < list_num; i++) {
fname = fn_list[i];
- prop_fname = get_prop_name(dpy, fs_list + i);
font_set = gen->font_set;
font_set_num = gen->font_set_num;
@@ -143,28 +144,34 @@ check_fontname(oc, name, found_num)
if (font_set->font_name)
continue;
- if (data = check_charset(font_set, fname))
- goto found;
- else if (prop_fname &&
- (data = check_charset(font_set, prop_fname))) {
- fname = prop_fname;
-found:
+ if ((data = check_charset(font_set, fname)) == NULL) {
+ if ((fn2_list = XListFontsWithInfo(dpy, name, MAXFONTS,
+ &list2_num, &fs_list))
+ && (prop_fname = get_prop_name(dpy, fs_list))
+ && (data = check_charset(font_set, prop_fname)))
+ fname = prop_fname;
+ }
+ if (data) {
font_set->side = data->side;
font_set->font_name = (char *) Xmalloc(strlen(fname) + 1);
if (font_set->font_name) {
strcpy(font_set->font_name, fname);
found_num++;
}
- if (found_num == gen->font_set_num)
- break;
}
+ if (fn2_list) {
+ XFreeFontInfo(fn2_list, fs_list, list2_num);
+ fn2_list = NULL;
+ if (prop_fname) {
+ Xfree(prop_fname);
+ prop_fname = NULL;
+ }
+ }
+ if (found_num == gen->font_set_num)
+ break;
}
- if (prop_fname)
- Xfree(prop_fname);
}
-
- XFreeFontInfo(fn_list, fs_list, list_num);
-
+ XFreeFontNames(fn_list);
return found_num;
}