aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman2006-05-22 01:02:40 +0000
committerRichard M. Stallman2006-05-22 01:02:40 +0000
commitccd97b5616246587c7072d8c23309b39419795a4 (patch)
tree30d6f2280b5232e804ccc458afdb26927219e76c /src
parente22fdc3682353a434e7bc40e48504ab2cacb611a (diff)
downloademacs-ccd97b5616246587c7072d8c23309b39419795a4.tar.gz
emacs-ccd97b5616246587c7072d8c23309b39419795a4.zip
(best_matching_font): Abort for best == NULL before we start to use it.
Diffstat (limited to 'src')
-rw-r--r--src/xfaces.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 2029f8fe65c..df303e401fd 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6677,30 +6677,30 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike)
6677 best = fonts + i; 6677 best = fonts + i;
6678 } 6678 }
6679 } 6679 }
6680
6681 if (needs_overstrike)
6682 {
6683 enum xlfd_weight want_weight = specified[XLFD_WEIGHT];
6684 enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
6685
6686 if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight)
6687 {
6688 /* We want a bold font, but didn't get one; try to use
6689 overstriking instead to simulate bold-face. However,
6690 don't overstrike an already-bold fontn unless the
6691 desired weight grossly exceeds the available weight. */
6692 if (got_weight > XLFD_WEIGHT_MEDIUM)
6693 *needs_overstrike = (got_weight - want_weight) > 2;
6694 else
6695 *needs_overstrike = 1;
6696 }
6697 }
6698 } 6680 }
6699 6681
6700 /* We should have found SOME font. */ 6682 /* We should have found SOME font. */
6701 if (best == NULL) 6683 if (best == NULL)
6702 abort (); 6684 abort ();
6703 6685
6686 if (! exact_p && needs_overstrike)
6687 {
6688 enum xlfd_weight want_weight = specified[XLFD_WEIGHT];
6689 enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
6690
6691 if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight)
6692 {
6693 /* We want a bold font, but didn't get one; try to use
6694 overstriking instead to simulate bold-face. However,
6695 don't overstrike an already-bold fontn unless the
6696 desired weight grossly exceeds the available weight. */
6697 if (got_weight > XLFD_WEIGHT_MEDIUM)
6698 *needs_overstrike = (got_weight - want_weight) > 2;
6699 else
6700 *needs_overstrike = 1;
6701 }
6702 }
6703
6704 if (font_scalable_p (best)) 6704 if (font_scalable_p (best))
6705 font_name = build_scalable_font_name (f, best, pt); 6705 font_name = build_scalable_font_name (f, best, pt);
6706 else 6706 else