summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfcambus <fcambus@openbsd.org>2019-01-09 11:23:32 +0000
committerfcambus <fcambus@openbsd.org>2019-01-09 11:23:32 +0000
commit4c444772e50e31f51b3940683a47abff19492bd2 (patch)
treeec7965880d4a07847d067fe4889532dbe7d407e9
parentmake spelling in previous consistent within the page; (diff)
downloadwireguard-openbsd-4c444772e50e31f51b3940683a47abff19492bd2.tar.xz
wireguard-openbsd-4c444772e50e31f51b3940683a47abff19492bd2.zip
Enable Spleen in wsfont and modify the font selection logic at runtime
in rasops(9) to allow selecting larger fonts when available. Summary of the changes: - Enable spleen8x16 for all architectures, replacing bold8x16_iso1. - Enable spleen12x24 on all arches but sparc64, replacing gallant12x22. - Enable spleen16x32 and spleen32x64 on amd64, i386, and arm64 for GENERIC kernels. - Modify the font selection logic in rasops(9) so the 16x32 and 32x64 fonts are selected if at least 120 columns can be displayed. Screens with widths equal or larger than 1920px will use the 16x32 font, and screens with widths equal or larger than 3840px the 32x64 one. OK kettenis@, ratchov@, deraadt@
-rw-r--r--sys/dev/rasops/rasops.c21
-rw-r--r--sys/dev/wsfont/wsfont.c42
2 files changed, 44 insertions, 19 deletions
diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c
index 4c1e8d28031..f9a017214cf 100644
--- a/sys/dev/rasops/rasops.c
+++ b/sys/dev/rasops/rasops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rasops.c,v 1.57 2018/09/22 17:40:57 kettenis Exp $ */
+/* $OpenBSD: rasops.c,v 1.58 2019/01/09 11:23:32 fcambus Exp $ */
/* $NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $ */
/*-
@@ -211,15 +211,24 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
#ifdef _KERNEL
/* Select a font if the caller doesn't care */
if (ri->ri_font == NULL) {
- int cookie;
+ int cookie = -1;
wsfont_init();
- if (ri->ri_width > 80*12)
- /* High res screen, choose a big font */
+ if (ri->ri_width >= 120 * 32)
+ /* Screen width larger than 3840px, 32px wide font */
+ cookie = wsfont_find(NULL, 32, 0, 0);
+
+ if (cookie <= 0 && ri->ri_width >= 120 * 16)
+ /* Screen width larger than 1920px, 16px wide font */
+ cookie = wsfont_find(NULL, 16, 0, 0);
+
+ if (cookie <= 0 && ri->ri_width > 80 * 12)
+ /* Screen width larger than 960px, 12px wide font */
cookie = wsfont_find(NULL, 12, 0, 0);
- else
- /* lower res, choose a 8 pixel wide font */
+
+ if (cookie <= 0)
+ /* Lower resolution, choose a 8px wide font */
cookie = wsfont_find(NULL, 8, 0, 0);
if (cookie <= 0)
diff --git a/sys/dev/wsfont/wsfont.c b/sys/dev/wsfont/wsfont.c
index 67f12c9d264..aa8b52f899e 100644
--- a/sys/dev/wsfont/wsfont.c
+++ b/sys/dev/wsfont/wsfont.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsfont.c,v 1.54 2018/12/02 14:44:33 fcambus Exp $ */
+/* $OpenBSD: wsfont.c,v 1.55 2019/01/09 11:23:32 fcambus Exp $ */
/* $NetBSD: wsfont.c,v 1.17 2001/02/07 13:59:24 ad Exp $ */
/*-
@@ -50,22 +50,18 @@
#ifdef FONT_SPLEEN8x16
#define HAVE_FONT 1
-#include <dev/wsfont/spleen8x16.h>
#endif
#ifdef FONT_SPLEEN12x24
#define HAVE_FONT 1
-#include <dev/wsfont/spleen12x24.h>
#endif
#ifdef FONT_SPLEEN16x32
#define HAVE_FONT 1
-#include <dev/wsfont/spleen16x32.h>
#endif
#ifdef FONT_SPLEEN32x64
#define HAVE_FONT 1
-#include <dev/wsfont/spleen32x64.h>
#endif
#ifdef FONT_BOLD8x16
@@ -79,6 +75,7 @@
#ifdef FONT_BOLD8x16_ISO1
#define HAVE_FONT 1
+#include <dev/wsfont/bold8x16-iso1.h>
#endif
/*
@@ -91,23 +88,42 @@
#ifndef HAVE_FONT
#define HAVE_FONT 1
-#define FONT_BOLD8x16_ISO1
-#if defined(__alpha__) || defined(__luna88k__) || defined(__macppc__) || \
- defined(__sgi__) || defined(__sparc64__) || \
- !defined(SMALL_KERNEL)
+#define FONT_SPLEEN8x16
+#if defined(__sparc64__)
#define FONT_GALLANT12x22
+#elif defined(__alpha__) || defined(__luna88k__) || defined(__macppc__) || \
+ defined(__sgi__) || !defined(SMALL_KERNEL)
+#define FONT_SPLEEN12x24
#endif
-#endif /* HAVE_FONT */
-
-#ifdef FONT_BOLD8x16_ISO1
-#include <dev/wsfont/bold8x16-iso1.h>
+#if !defined(SMALL_KERNEL) && (defined(__amd64__) || defined(__i386__) || \
+ defined(__arm64__))
+#define FONT_SPLEEN16x32
+#define FONT_SPLEEN32x64
#endif
+#endif /* HAVE_FONT */
+
#ifdef FONT_GALLANT12x22
#include <dev/wsfont/gallant12x22.h>
#endif
+#ifdef FONT_SPLEEN8x16
+#include <dev/wsfont/spleen8x16.h>
+#endif
+
+#ifdef FONT_SPLEEN12x24
+#include <dev/wsfont/spleen12x24.h>
+#endif
+
+#ifdef FONT_SPLEEN16x32
+#include <dev/wsfont/spleen16x32.h>
+#endif
+
+#ifdef FONT_SPLEEN32x64
+#include <dev/wsfont/spleen32x64.h>
+#endif
+
struct font {
TAILQ_ENTRY(font) chain;
struct wsdisplay_font *font;