aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-07-31 16:44:49 +0000
committerRichard M. Stallman1997-07-31 16:44:49 +0000
commit536f4067ef9d74f728aeaed816c5487954d7f283 (patch)
treef99edb071f67d999db69b4b362bf46882f592fe2 /src
parenta69e7dae70a7e48bf463abe6c208d7d9a080bee4 (diff)
downloademacs-536f4067ef9d74f728aeaed816c5487954d7f283.tar.gz
emacs-536f4067ef9d74f728aeaed816c5487954d7f283.zip
(x_list_fonts): Reject a font whose min_bounds.width is 0.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 62ea22abeee..742bffd84d9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,5 +1,5 @@
1/* X Communication module for terminals which understand the X protocol. 1/* X Communication module for terminals which understand the X protocol.
2 Copyright (C) 1989, 93, 94, 95, 1996 Free Software Foundation, Inc. 2 Copyright (C) 1989, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -6365,7 +6365,10 @@ x_list_fonts (f, pattern, size, maxnames)
6365 char **names; 6365 char **names;
6366 6366
6367 pattern = XCONS (patterns)->car; 6367 pattern = XCONS (patterns)->car;
6368 /* See if we cached the result for this particular query. */ 6368 /* See if we cached the result for this particular query.
6369 The cache is an alist of the form:
6370 (((PATTERN . MAXNAMES) (FONTNAME . WIDTH) ...) ...)
6371 */
6369 if (f && (tem = XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr, 6372 if (f && (tem = XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr,
6370 key = Fcons (pattern, make_number (maxnames)), 6373 key = Fcons (pattern, make_number (maxnames)),
6371 !NILP (list = Fassoc (key, tem)))) 6374 !NILP (list = Fassoc (key, tem))))
@@ -6439,6 +6442,8 @@ x_list_fonts (f, pattern, size, maxnames)
6439 /* Make a list of the fonts that have the right width. */ 6442 /* Make a list of the fonts that have the right width. */
6440 for (; CONSP (list); list = XCONS (list)->cdr) 6443 for (; CONSP (list); list = XCONS (list)->cdr)
6441 { 6444 {
6445 int found_size;
6446
6442 tem = XCONS (list)->car; 6447 tem = XCONS (list)->car;
6443 6448
6444 if (!CONSP (tem) || NILP (XCONS (tem)->car)) 6449 if (!CONSP (tem) || NILP (XCONS (tem)->car))
@@ -6462,7 +6467,10 @@ x_list_fonts (f, pattern, size, maxnames)
6462 6467
6463 if (thisinfo) 6468 if (thisinfo)
6464 { 6469 {
6465 XCONS (tem)->cdr = make_number (thisinfo->max_bounds.width); 6470 XCONS (tem)->cdr
6471 = (thisinfo->min_bounds.width == 0
6472 ? make_number (0)
6473 : make_number (thisinfo->max_bounds.width));
6466 XFreeFont (dpy, thisinfo); 6474 XFreeFont (dpy, thisinfo);
6467 } 6475 }
6468 else 6476 else
@@ -6471,21 +6479,26 @@ x_list_fonts (f, pattern, size, maxnames)
6471 as 0 not to try to open it again. */ 6479 as 0 not to try to open it again. */
6472 XCONS (tem)->cdr = make_number (0); 6480 XCONS (tem)->cdr = make_number (0);
6473 } 6481 }
6474 if (XINT (XCONS (tem)->cdr) == size) 6482
6483 found_size = XINT (XCONS (tem)->cdr);
6484 if (found_size == size)
6475 newlist = Fcons (XCONS (tem)->car, newlist); 6485 newlist = Fcons (XCONS (tem)->car, newlist);
6476 else if (NILP (second_best)) 6486 else if (found_size > 0)
6477 second_best = tem;
6478 else if (XINT (XCONS (tem)->cdr) < size)
6479 {
6480 if (XINT (XCONS (second_best)->cdr) > size
6481 || XINT (XCONS (second_best)->cdr) < XINT (XCONS (tem)->cdr))
6482 second_best = tem;
6483 }
6484 else
6485 { 6487 {
6486 if (XINT (XCONS (second_best)->cdr) > size 6488 if (NILP (second_best))
6487 && XINT (XCONS (second_best)->cdr) > XINT (XCONS (tem)->cdr))
6488 second_best = tem; 6489 second_best = tem;
6490 else if (found_size < size)
6491 {
6492 if (XINT (XCONS (second_best)->cdr) > size
6493 || XINT (XCONS (second_best)->cdr) < found_size)
6494 second_best = tem;
6495 }
6496 else
6497 {
6498 if (XINT (XCONS (second_best)->cdr) > size
6499 && XINT (XCONS (second_best)->cdr) > found_size)
6500 second_best = tem;
6501 }
6489 } 6502 }
6490 } 6503 }
6491 if (!NILP (newlist)) 6504 if (!NILP (newlist))