Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wsfont When searching for a best font also allow fon...



details:   https://anonhg.NetBSD.org/src/rev/29a13a8ffd13
branches:  trunk
changeset: 338062:29a13a8ffd13
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat May 09 16:40:37 2015 +0000

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

diffstat:

 sys/dev/wsfont/wsfont.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 27536524637a -r 29a13a8ffd13 sys/dev/wsfont/wsfont.c
--- a/sys/dev/wsfont/wsfont.c   Sat May 09 15:42:21 2015 +0000
+++ b/sys/dev/wsfont/wsfont.c   Sat May 09 16:40:37 2015 +0000
@@ -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 @@
 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 @@
                                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);
                }
        }
 



Home | Main Index | Thread Index | Old Index