diff options
author | Richard M. Stallman <rms@gnu.org> | 2006-05-22 01:02:40 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2006-05-22 01:02:40 +0000 |
commit | ccd97b5616246587c7072d8c23309b39419795a4 (patch) | |
tree | 30d6f2280b5232e804ccc458afdb26927219e76c /src/xfaces.c | |
parent | e22fdc3682353a434e7bc40e48504ab2cacb611a (diff) | |
download | emacs-ccd97b5616246587c7072d8c23309b39419795a4.tar.gz |
(best_matching_font): Abort for best == NULL before we start to use it.
Diffstat (limited to 'src/xfaces.c')
-rw-r--r-- | src/xfaces.c | 36 |
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) best = fonts + i; } } - - if (needs_overstrike) - { - enum xlfd_weight want_weight = specified[XLFD_WEIGHT]; - enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT]; - - if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight) - { - /* We want a bold font, but didn't get one; try to use - overstriking instead to simulate bold-face. However, - don't overstrike an already-bold fontn unless the - desired weight grossly exceeds the available weight. */ - if (got_weight > XLFD_WEIGHT_MEDIUM) - *needs_overstrike = (got_weight - want_weight) > 2; - else - *needs_overstrike = 1; - } - } } /* We should have found SOME font. */ if (best == NULL) abort (); + if (! exact_p && needs_overstrike) + { + enum xlfd_weight want_weight = specified[XLFD_WEIGHT]; + enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT]; + + if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight) + { + /* We want a bold font, but didn't get one; try to use + overstriking instead to simulate bold-face. However, + don't overstrike an already-bold fontn unless the + desired weight grossly exceeds the available weight. */ + if (got_weight > XLFD_WEIGHT_MEDIUM) + *needs_overstrike = (got_weight - want_weight) > 2; + else + *needs_overstrike = 1; + } + } + if (font_scalable_p (best)) font_name = build_scalable_font_name (f, best, pt); else |