aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2009-07-28 02:07:05 +0000
committerKenichi Handa2009-07-28 02:07:05 +0000
commit4fa58085e38a947ebdd0e9e8e505f23ea2aaecbd (patch)
treef15de659722db9a0274a3c2867a83616453c8876
parent92491c14be24837ca8cff20e6945eb1063b0b32d (diff)
downloademacs-4fa58085e38a947ebdd0e9e8e505f23ea2aaecbd.tar.gz
emacs-4fa58085e38a947ebdd0e9e8e505f23ea2aaecbd.zip
(xfont_list_pattern): Don't ignore the return value of
font_parse_xlfd. Check font properties more rigidly.
-rw-r--r--src/xfont.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/xfont.c b/src/xfont.c
index ad12800efb4..7db7cae5c65 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -411,16 +411,25 @@ xfont_list_pattern (Display *display, char *pattern,
411 continue; 411 continue;
412 entity = font_make_entity (); 412 entity = font_make_entity ();
413 xfont_decode_coding_xlfd (indices[i], -1, buf); 413 xfont_decode_coding_xlfd (indices[i], -1, buf);
414 font_parse_xlfd (buf, entity); 414 if (font_parse_xlfd (buf, entity) < 0)
415 continue;
415 ASET (entity, FONT_TYPE_INDEX, Qx); 416 ASET (entity, FONT_TYPE_INDEX, Qx);
416 /* Avoid auto-scaled fonts. */ 417 /* Avoid auto-scaled fonts. */
417 if (XINT (AREF (entity, FONT_DPI_INDEX)) != 0 418 if (INTEGERP (AREF (entity, FONT_DPI_INDEX))
419 && INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX))
420 && XINT (AREF (entity, FONT_DPI_INDEX)) != 0
418 && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0) 421 && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0)
419 continue; 422 continue;
420 /* Avoid not-allowed scalable fonts. */ 423 /* Avoid not-allowed scalable fonts. */
421 if (NILP (Vscalable_fonts_allowed)) 424 if (NILP (Vscalable_fonts_allowed))
422 { 425 {
423 if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0) 426 int size = 0;
427
428 if (INTEGERP (AREF (entity, FONT_SIZE_INDEX)))
429 size = XINT (AREF (entity, FONT_SIZE_INDEX));
430 else if (FLOATP (AREF (entity, FONT_SIZE_INDEX)))
431 size = XFLOAT_DATA (AREF (entity, FONT_SIZE_INDEX));
432 if (size == 0)
424 continue; 433 continue;
425 } 434 }
426 else if (CONSP (Vscalable_fonts_allowed)) 435 else if (CONSP (Vscalable_fonts_allowed))
@@ -439,6 +448,10 @@ xfont_list_pattern (Display *display, char *pattern,
439 continue; 448 continue;
440 } 449 }
441 450
451 /* Avoid fonts of invalid registry. */
452 if (NILP (AREF (entity, FONT_REGISTRY_INDEX)))
453 continue;
454
442 /* Update encoding and repertory if necessary. */ 455 /* Update encoding and repertory if necessary. */
443 if (! EQ (registry, AREF (entity, FONT_REGISTRY_INDEX))) 456 if (! EQ (registry, AREF (entity, FONT_REGISTRY_INDEX)))
444 { 457 {