changeset 70834:7ca4cd6f07f2

(best_matching_font): Abort for best == NULL before we start to use it.
author Richard M. Stallman <rms@gnu.org>
date Mon, 22 May 2006 01:02:40 +0000
parents ea33fa838697
children fd87105a0d34
files src/xfaces.c
diffstat 1 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfaces.c	Sun May 21 23:53:29 2006 +0000
+++ b/src/xfaces.c	Mon May 22 01:02:40 2006 +0000
@@ -6677,30 +6677,30 @@
 		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