Index: sys/dev/wscons/wsconsio.h =================================================================== RCS file: /cvsroot/src/sys/dev/wscons/wsconsio.h,v retrieving revision 1.127 diff -p -u -r1.127 wsconsio.h --- sys/dev/wscons/wsconsio.h 20 Jan 2024 00:23:12 -0000 1.127 +++ sys/dev/wscons/wsconsio.h 21 Apr 2024 10:07:41 -0000 @@ -729,4 +730,20 @@ struct wsdisplayio_fontinfo { #define WSDISPLAYIO_LISTFONTS _IOWR('W', 107, struct wsdisplayio_fontinfo) +struct wsdisplay_getfont { + char *gf_name; + uint32_t gf_size; + uint32_t gf_actual; +}; + +/* + * return currently active font + * + * gf_name points to a buffer of gf_size bytes, the result may be truncated + * and NUL-terminated. + * gf_actual is set to the size of full name. + */ + +#define WSDISPLAYIO_GFONT _IOWR('W', 108, struct wsdisplay_getfont) + #endif /* _DEV_WSCONS_WSCONSIO_H_ */ Index: sys/dev/wscons/wsdisplay.c =================================================================== RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay.c,v retrieving revision 1.166 diff -p -u -r1.166 wsdisplay.c --- sys/dev/wscons/wsdisplay.c 1 Mar 2023 08:42:33 -0000 1.166 +++ sys/dev/wscons/wsdisplay.c 21 Apr 2024 10:07:42 -0000 @@ -1440,6 +1461,12 @@ wsdisplay_internal_ioctl(struct wsdispla return error; #undef d + case WSDISPLAYIO_GFONT: + error = (*sc->sc_accessops->ioctl)(sc->sc_accesscookie, + scr->scr_dconf->emulcookie, cmd, data, flag, l); + + return error; + #ifdef WSDISPLAY_CUSTOM_OUTPUT case WSDISPLAYIO_GMSGATTRS: #define d ((struct wsdisplay_msgattrs *)data) Index: sys/dev/wscons/wsdisplay_vcons.c =================================================================== RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay_vcons.c,v retrieving revision 1.68 diff -p -u -r1.68 wsdisplay_vcons.c --- sys/dev/wscons/wsdisplay_vcons.c 9 Feb 2024 22:08:37 -0000 1.68 +++ sys/dev/wscons/wsdisplay_vcons.c 21 Apr 2024 10:07:42 -0000 @@ -841,6 +844,20 @@ vcons_ioctl(void *v, void *vs, u_long cm } break; + case WSDISPLAYIO_GFONT: { + struct wsdisplay_getfont *gf = data; + size_t actual; + struct wsdisplay_font *font; + const char *fontname; + + font = ((struct vcons_screen *)vs)->scr_ri.ri_font; + fontname = font && font->name ? font->name : ""; + error = copyoutstr(fontname, gf->gf_name, gf->gf_size, &actual); + if (!error) + gf->gf_actual = actual; + } + break; + default: if (vdp->ioctl != NULL) error = (*vdp->ioctl)(v, vs, cmd, data, flag, l);