(best_matching_font): Abort for best == NULL before we start to use it.

This commit is contained in:
Richard M. Stallman 2006-05-22 01:02:40 +00:00
parent e22fdc3682
commit ccd97b5616

View file

@ -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