summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorFrederic Cambus <fcambus@cvs.openbsd.org>2020-08-05 13:56:07 +0000
committerFrederic Cambus <fcambus@cvs.openbsd.org>2020-08-05 13:56:07 +0000
commitebe3c668d5327ef9b5529f8245e45fb67997d1b4 (patch)
tree1bd432f10af63d0f981b794fe310a825b9ba863f /usr.sbin
parentb8f93bef5ff2f5237fd42202b520037e81fb698d (diff)
Get the default values for font height and width in wsfontload(8) using
the WSDISPLAYIO_GETSCREENTYPE ioctl. This ensures that they always match the currently loaded font metrics. Previously, wsfontload(8) hardcoded the default height and width values for the font to be loaded as 12x22 when using framebuffer consoles, and as 8x16 when in text mode. The 12x22 value wasn't correct in case we felt back to the smaller 8x16 font for screen widths smaller than 960px, and wasn't valid anymore since we replaced Gallant 12x22 by Spleen 12x24 on all architectures but sparc64. OK jcs@, mpi@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/wsfontload/wsfontload.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/usr.sbin/wsfontload/wsfontload.c b/usr.sbin/wsfontload/wsfontload.c
index a6841a655e3..1ed693f2d67 100644
--- a/usr.sbin/wsfontload/wsfontload.c
+++ b/usr.sbin/wsfontload/wsfontload.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsfontload.c,v 1.22 2020/07/20 14:09:24 fcambus Exp $ */
+/* $OpenBSD: wsfontload.c,v 1.23 2020/08/05 13:56:06 fcambus Exp $ */
/* $NetBSD: wsfontload.c,v 1.2 2000/01/05 18:46:43 ad Exp $ */
/*
@@ -76,6 +76,7 @@ main(int argc, char *argv[])
{
char *wsdev, *infile, *p;
struct wsdisplay_font f;
+ struct wsdisplay_screentype screens;
int c, res, wsfd, ffd, type, list, i;
int defwidth, defheight;
struct stat stat;
@@ -178,23 +179,16 @@ main(int argc, char *argv[])
ffd = STDIN_FILENO;
}
- res = ioctl(wsfd, WSDISPLAYIO_GTYPE, &type);
- if (res != 0)
- type = WSDISPLAY_TYPE_UNKNOWN;
-
- switch (type) {
- /* text-mode VGA */
- case WSDISPLAY_TYPE_ISAVGA:
- case WSDISPLAY_TYPE_PCIVGA:
+ memset(&screens, 0, sizeof(screens));
+ res = ioctl(wsfd, WSDISPLAYIO_GETSCREENTYPE, &screens);
+ if (res == 0) {
+ /* raster frame buffers */
+ defwidth = screens.fontwidth;
+ defheight = screens.fontheight;
+ } else {
+ /* text-mode VGA */
defwidth = 8;
defheight = 16;
- break;
- /* raster frame buffers */
- default:
- /* XXX ought to be computed from the frame buffer resolution */
- defwidth = 12;
- defheight = 22;
- break;
}
f.index = -1;