Mercurial > emacs
diff src/xterm.c @ 49859:c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
names.
* xfaces.c (x_face_list_fonts): Allocate struct font_name here.
(sorted_font_list): Moved allocation of struct font_name to
x_face_list_fonts.
(Fx_font_family_list): Set font-list-limit to -1 to get all font names.
(Fx_list_fonts): Set maxnames to -1 to get all font names.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Tue, 18 Feb 2003 21:30:08 +0000 |
parents | 05ebf4266798 |
children | b5ec65424fcc |
line wrap: on
line diff
--- a/src/xterm.c Tue Feb 18 16:33:32 2003 +0000 +++ b/src/xterm.c Tue Feb 18 21:30:08 2003 +0000 @@ -14536,8 +14536,28 @@ { /* We try at least 10 fonts because XListFonts will return auto-scaled fonts at the head. */ - names = XListFonts (dpy, SDATA (pattern), max (maxnames, 10), - &num_fonts); + if (maxnames < 0) + { + int limit; + + for (limit = 500;;) + { + names = XListFonts (dpy, SDATA (pattern), limit, &num_fonts); + if (num_fonts == limit) + { + BLOCK_INPUT; + XFreeFontNames (names); + UNBLOCK_INPUT; + limit *= 2; + } + else + break; + } + } + else + names = XListFonts (dpy, SDATA (pattern), max (maxnames, 10), + &num_fonts); + if (x_had_errors_p (dpy)) { /* This error is perhaps due to insufficient memory on X