Module Name:    src
Committed By:   mlelstv
Date:           Sat May  9 16:40:37 UTC 2015

Modified Files:
        src/sys/dev/wsfont: wsfont.c

Log Message:
When searching for a best font also allow fonts too wide for the
desired display columns but penalize these against all narrower ones.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/wsfont/wsfont.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wsfont/wsfont.c
diff -u src/sys/dev/wsfont/wsfont.c:1.58 src/sys/dev/wsfont/wsfont.c:1.59
--- src/sys/dev/wsfont/wsfont.c:1.58	Sat Apr 18 11:23:58 2015
+++ src/sys/dev/wsfont/wsfont.c	Sat May  9 16:40:37 2015
@@ -1,4 +1,4 @@
-/* 	$NetBSD: wsfont.c,v 1.58 2015/04/18 11:23:58 mlelstv Exp $	*/
+/* 	$NetBSD: wsfont.c,v 1.59 2015/05/09 16:40:37 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.58 2015/04/18 11:23:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.59 2015/05/09 16:40:37 mlelstv Exp $");
 
 #include "opt_wsfont.h"
 
@@ -570,7 +570,7 @@ int
 wsfont_matches(struct wsdisplay_font *font, const char *name,
 	       int width, int height, int stride, int flags)
 {
-	int score = 10000;
+	int score = 20000;
 
 	/* first weed out fonts the caller doesn't claim support for */
 	if (FONT_IS_ALPHA(font)) {
@@ -590,8 +590,9 @@ wsfont_matches(struct wsdisplay_font *fo
 				return (0);
 		} else {
 			if (font->fontwidth > width)
-				return (0);
-			score -= min(width - font->fontwidth, 9999);
+				score -= 10000 + min(font->fontwidth - width, 9999);
+			else
+				score -= min(width - font->fontwidth, 9999);
 		}
 	}
 

Reply via email to