summaryrefslogtreecommitdiff
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2006-05-22 01:02:40 +0000
committerRichard M. Stallman <rms@gnu.org>2006-05-22 01:02:40 +0000
commitccd97b5616246587c7072d8c23309b39419795a4 (patch)
tree30d6f2280b5232e804ccc458afdb26927219e76c /src/xfaces.c
parente22fdc3682353a434e7bc40e48504ab2cacb611a (diff)
downloademacs-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.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)
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