aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2003-10-24 00:40:10 +0000
committerKenichi Handa2003-10-24 00:40:10 +0000
commit285f930490fbcd4529f2dca6618d2f86a49a0fe8 (patch)
treee8e44e8beb68693b06c40b4563cfb88329d3ff55 /src
parentc052767cc1a30791f33a78c8773e77d2c2dd1a90 (diff)
downloademacs-285f930490fbcd4529f2dca6618d2f86a49a0fe8.tar.gz
emacs-285f930490fbcd4529f2dca6618d2f86a49a0fe8.zip
(x_list_fonts): Fix excluding of auto-scaled fonts.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/xterm.c b/src/xterm.c
index c31318c88f4..0457be6d73b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9416,7 +9416,7 @@ x_get_font_info (f, font_idx)
9416 If SIZE is > 0, it is the size (maximum bounds width) of fonts 9416 If SIZE is > 0, it is the size (maximum bounds width) of fonts
9417 to be listed. 9417 to be listed.
9418 9418
9419 SIZE < 0 means include scalable fonts. 9419 SIZE < 0 means include auto scaled fonts.
9420 9420
9421 Frame F null means we have not yet created any frame on X, and 9421 Frame F null means we have not yet created any frame on X, and
9422 consult the first display in x_display_list. MAXNAMES sets a limit 9422 consult the first display in x_display_list. MAXNAMES sets a limit
@@ -9436,11 +9436,11 @@ x_list_fonts (f, pattern, size, maxnames)
9436 Display *dpy = dpyinfo->display; 9436 Display *dpy = dpyinfo->display;
9437 int try_XLoadQueryFont = 0; 9437 int try_XLoadQueryFont = 0;
9438 int count; 9438 int count;
9439 int allow_scalable_fonts_p = 0; 9439 int allow_auto_scaled_font = 0;
9440 9440
9441 if (size < 0) 9441 if (size < 0)
9442 { 9442 {
9443 allow_scalable_fonts_p = 1; 9443 allow_auto_scaled_font = 1;
9444 size = 0; 9444 size = 0;
9445 } 9445 }
9446 9446
@@ -9463,7 +9463,7 @@ x_list_fonts (f, pattern, size, maxnames)
9463 ((((PATTERN . MAXNAMES) . SCALABLE) (FONTNAME . WIDTH) ...) ...) */ 9463 ((((PATTERN . MAXNAMES) . SCALABLE) (FONTNAME . WIDTH) ...) ...) */
9464 tem = XCDR (dpyinfo->name_list_element); 9464 tem = XCDR (dpyinfo->name_list_element);
9465 key = Fcons (Fcons (pattern, make_number (maxnames)), 9465 key = Fcons (Fcons (pattern, make_number (maxnames)),
9466 allow_scalable_fonts_p ? Qt : Qnil); 9466 allow_auto_scaled_font ? Qt : Qnil);
9467 list = Fassoc (key, tem); 9467 list = Fassoc (key, tem);
9468 if (!NILP (list)) 9468 if (!NILP (list))
9469 { 9469 {
@@ -9569,25 +9569,28 @@ x_list_fonts (f, pattern, size, maxnames)
9569 { 9569 {
9570 int width = 0; 9570 int width = 0;
9571 char *p = names[i]; 9571 char *p = names[i];
9572 int average_width = -1, dashes = 0; 9572 int average_width = -1, resx = 0, dashes = 0;
9573 9573
9574 /* Count the number of dashes in NAMES[I]. If there are 9574 /* Count the number of dashes in NAMES[I]. If there are
9575 14 dashes, and the field value following 12th dash 9575 14 dashes, the field value following 9th dash
9576 (AVERAGE_WIDTH) is 0, this is a auto-scaled font which 9576 (RESOLUTION_X) is nonzero, and the field value
9577 is usually too ugly to be used for editing. Let's 9577 following 12th dash (AVERAGE_WIDTH) is 0, this is a
9578 ignore it. */ 9578 auto-scaled font which is usually too ugly to be used
9579 for editing. Let's ignore it. */
9579 while (*p) 9580 while (*p)
9580 if (*p++ == '-') 9581 if (*p++ == '-')
9581 { 9582 {
9582 dashes++; 9583 dashes++;
9583 if (dashes == 7) /* PIXEL_SIZE field */ 9584 if (dashes == 7) /* PIXEL_SIZE field */
9584 width = atoi (p); 9585 width = atoi (p);
9586 else if (dashes == 9)
9587 resx = atoi (p);
9585 else if (dashes == 12) /* AVERAGE_WIDTH field */ 9588 else if (dashes == 12) /* AVERAGE_WIDTH field */
9586 average_width = atoi (p); 9589 average_width = atoi (p);
9587 } 9590 }
9588 9591
9589 if (allow_scalable_fonts_p 9592 if (allow_auto_scaled_font
9590 || dashes < 14 || average_width != 0) 9593 || dashes < 14 || average_width != 0 || resx == 0)
9591 { 9594 {
9592 tem = build_string (names[i]); 9595 tem = build_string (names[i]);
9593 if (NILP (Fassoc (tem, list))) 9596 if (NILP (Fassoc (tem, list)))