From: Alan Mackenzie <acm@muc.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Simona Vetter <simona@ffwll.ch>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Helge Deller <deller@gmx.de>,
Thomas Zimmermann <tzimmermann@suse.de>,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: acm@muc.de
Subject: vt: Enlarge the framebuffer glyph size from 16 to 32 bits
Date: Thu, 27 Aug 2026 18:38:04 +0000 [thread overview]
Message-ID: <apCEDM2sWv_M354-@MAC.fritz.box> (raw)
[-- Attachment #1: Type: text/plain, Size: 23433 bytes --]
vt: Enlarge the framebuffer glyph size from 16 to 32 bits.
This allows:
o - More than 256/512 distinct half-width glyphs (in fact, up to 2^21).
o - Unicode code points >0xffff (outside the Basic Multilingual Plane).
o - Coloured glyphs (as before).
The patch doesn't improve the handling of full-width glyphs.
To maximise backward compatibility:
o - The enlarged glyph size must be positively configured in the kernel by
enabling CONFIG_FB_GLYPH_21BIT. Without this, the glyph size remains 16
bits as before.
o - Existing console fonts can still be loaded and used.
o - The console keyboard handling remains unchanged.
The format of PSFU font files remains unchanged, and the utility programs
txt2psf and psf2txt (from package psftools) work unchanged on the new fonts.
An enhanced protocol is needed for the up-/downloading of fonts, and thus
enhanced versions of the utility programs setfont and showconsolefont.
The new kernel requires two new ioctl codes, which have been provisionally
given these values in include/uapi/linux/kd.h:
o - #define GIO_UNIMAP21 0x4B6E
o - #define PIO_UNIMAP21 0x4B6F.
These are like GIO_UNIMAP and PIO_UNIMAP but work with 21-bit code point and
glyph numbers. They are used to get and put the new font format, and are
needed by setfont and showconsolefont.
Some pertinent code has not yet been amended for the new feature. In
particular, the files fbcon_cw.c, fbcon_ud.c, fbcon_ccw.c (which display
rotated output on the screen) still need amendment.
For the time being, CONFIG_A11Y_BRAILLE_CONSOLE and CONFIG_SPEAKUP have been
disabled when CONFIG_FB_GLYPH_21BIT is set, until it becomes clear how to
integrate them.
The new code has been tested only on an AMD64 system. In particular, it
hasn't been tested on a big-endian system.
For the avoidance of doubt, no LLM has been used in the preparation of this
change.
#########################################################################
Building the Kernel
-------------------
Apply the patch series.
The new option CONFIG_FB_GLYPH_21BIT can be found in the make menuconfig tree
under Device Drivers/Graphics support/Direct Rendering Manager/Supported DRM
clients/Enable legacy fbdev support .../Enable 21-bit glyphs .... Enable
CONFIG_DRM_FBDEV_EMULATION and CONFIG_FB_GLYPH_21BIT.
[ Note: the kernel can alternatively be built with CONFIG_FB_GLYPH_21BIT
unset, in which case it uses the well known 16-bit glyphs, essentially
unchanged from the current kernel. ]
Also enable CONFIG_HEADERS_INSTALL, so that the user side version of kd.h will
get built in usr/include/linux/kd.h. This is needed by the enhanced version
of the kbd package. After building, ensure it gets copied to where the
compiler will find it.
Build the kernel in the usual way, and install it into your boot loader.
#########################################################################
Testing
-------
To try out the new features, you will need a console font with glyphs outside
the Basic Multilingual Plane, and an enhanced setfont program (which uses one
of the new ioctl codes above) to load it with.
The font latn-16-unifont-base+upper.psfu.gz attached to this post has 11,240
glyphs, and its source code can be inspected by gunzipping it and feeding it
through the program psf2txt from the package psftools. This font was hacked
together from the standard fonts lat<n>-16 and parts of GNU Unifont. Examples
of code points outside the Basic Multilingual Plane are U+1fbf0 to U+1fbf9,
variants of the decimal digits.
To enter a Unicode code point on the keyboard, the partial keymap
/usr/share/keymaps/i386/include/keypad.map.gz is useful. With it, one can
hold down the AltGr key and type in the codepoint in hex using 16 of the
keypad keys.
An enhanced version of setfont, built for AMD64, is also attached. The source
code for this, in the form of a unified diff from the commit with tag v2.9.0
in the repository
git://git.kernel.org/pub/scm/linux/kernel/git/legion/kbd.git, is at the end of
this post. Before building this version of kbd, ensure that the kernel has
been build with CONFIG_HEADERS_INSTALL set, and that the newly generated
usr/include/linux/kd.h has been copied to somewhere the compiler will find it.
#########################################################################
Kernel Patches
--------------
The series of patches applies cleanly to:
commit 8b0b29fdcb47907ae0296b8fe829e918e05e300f
(HEAD -> tty-testing, origin/tty-testing, origin/tty-next)
Author: Karl Mehltretter <kmehltretter@gmail.com>
Date: Fri Jul 31 20:18:44 2026 +0200rts[] lifetimert in imx_uart_ports[]ntryt)gnamic")
in branch origin/testing of repository
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git.
This series of patches is essentially a single atomic patch; no partial
application of them will result in a useful kernel. The 3,500 line patch from
git diff has been divided according to theme, although this is approximate
since not all larger diff hunks have been split into "components".
These files get changed by the patches:
drivers/accessibility/Kconfig
drivers/accessibility/speakup/Kconfig
drivers/gpu/drm/clients/Kconfig
drivers/tty/vt/consolemap.c
drivers/tty/vt/keyboard.c
drivers/tty/vt/selection.c
drivers/tty/vt/vc_screen.c
drivers/tty/vt/vt.c
drivers/tty/vt/vt_ioctl.c
drivers/video/fbdev/core/bitblit.c
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbcon.h
include/linux/console_struct.h
include/linux/consolemap.h
include/linux/selection.h
include/linux/vt_buffer.h
include/linux/vt_kern.h
include/uapi/linux/kd.h
The patches are as follows:
(i) 1 "Make consolemap.c handle Unicode planes outside BMP" contains the
enhancements to drivers/tty/vt/consolemap.c to handle 21 bit codepoints
(outside the BMP).
(ii) 2 "Glyph size: Use GLYPH_SZ/HW rather than hardcoded 2, 1" substitutes
the #defines GLYPH_SZ and GLYPH_HW, the size of a glyph in bytes and half
words, for the previously hard coded and implicit values of 2 and 1.
(iii) 3 "Replace scr_readw/writew by scr_readg/writeg, etc" is the replacement
of the macros scr_readw/writew with scr_readg, scr_writeg,
scr_readg_plusplus, scr_writeg_plusplus (where "g" stands for "glyph").
Also one or two other similar macros are replaced.
(iv) 4 "Amend internal manipulation of glyph structure" contains amendments to
the manipulations of the internal structure of the now 32 bit glyph from the
previous 16 bit glyph.
(v) 5 "Amend three Kconfig files" has the changes to three Kconfig files. One
of these introduces CONFIG_FB_GLYPH_21BIT, the other two mask accessibility
features of the terminal until it becomes clear how to integrate them.
(vi) 6 "Use u32 and typedef u1632 to handle whole glyphs" introduces the
typedef u1632 (which is either u16 or u32 depending on
CONFIG_FB_GLYPH_21BIT) and contains the changes for its use, and needed
changes from u16 to u32.
(vii) 7 "Handle up to 2^21 glyphs, rather than 256/512" handles the change in
the maximum number of glyphs from 256/512 to 0x110000.
(viii) 8 "Enhancements to the VT ioctl interface" contains the changes to
drivers/tty/vt/vt_ioctl.c including the handling of GIO_UNIMAP21 and
PIO_UNIMAP21, and the conversion of userspace data (whether 16 or 21 bit) to
the new internal 21 bit format.
(ix) 9 "Misc changes, e.g. to #include directives" Miscellaneous changes which
didn't fit anywhere else, including reordering some #include directives in
the .c files.
#########################################################################
Enhancements to git://git.kernel.org/pub/scm/linux/kernel/git/legion/kbd.git,
-----------------------------------------------------------------------------
tag v2.9.0, for setfont.
------------------------
diff --git a/src/include/kbd/kfont.h b/src/include/kbd/kfont.h
index 67ad917..570b5f0 100644
--- a/src/include/kbd/kfont.h
+++ b/src/include/kbd/kfont.h
@@ -211,7 +211,9 @@ int kfont_get_unicodemap(struct kfont_context *ctx, int consolefd,
KBD_ATTR_NONNULL(1, 3);
int kfont_put_unicodemap(struct kfont_context *ctx, int consolefd,
- struct unimapinit *ui, struct unimapdesc *ud)
+ struct unimapinit *ui,
+ int bit21,
+ struct unimapdesc *ud, struct unimapdesc21 *ud21)
KBD_ATTR_NONNULL(1);
/* setfont.c */
@@ -269,7 +271,8 @@ int kfont_read_psffont(struct kfont_context *ctx,
unsigned char **fontbufp, unsigned int *fontszp,
unsigned int *fontwidthp, unsigned int *fontheightp,
unsigned int *fontlenp, unsigned int fontpos0,
- struct unicode_list **uclistheadsp)
+ struct unicode_list **uclistheadsp,
+ int *bit21)
KBD_ATTR_NONNULL(1);
int kfont_write_psffont(struct kfont_context *ctx,
diff --git a/src/libkbdfile/kbdfile.c b/src/libkbdfile/kbdfile.c
index 5b1ee6d..50b117f 100644
--- a/src/libkbdfile/kbdfile.c
+++ b/src/libkbdfile/kbdfile.c
@@ -337,7 +337,8 @@ static int
findfile_in_dir(const char *fnam, const char *dir, const int recdepth, const char *const *suf, struct kbdfile *fp)
{
char errbuf[200];
- char *ff, *fdir, *path;
+ const char *ff;
+ char *fdir, *path;
int rc = 1, secondpass = 0;
size_t dir_len;
diff --git a/src/libkfont/kdmapop.c b/src/libkfont/kdmapop.c
index b868f7b..5be0b88 100644
--- a/src/libkfont/kdmapop.c
+++ b/src/libkfont/kdmapop.c
@@ -179,7 +179,9 @@ kfont_get_unicodemap(struct kfont_context *ctx, int fd, struct unimapdesc *ud0)
}
int
-kfont_put_unicodemap(struct kfont_context *ctx, int fd, struct unimapinit *ui, struct unimapdesc *ud)
+kfont_put_unicodemap(struct kfont_context *ctx, int fd, struct unimapinit *ui,
+ int bit21,
+ struct unimapdesc *ud, struct unimapdesc21 *ud21)
{
struct unimapinit advice;
@@ -202,10 +204,26 @@ again:
KFONT_ERR(ctx, "ioctl(PIO_UNIMAPCLR): %m");
return -1;
}
- if (ud == NULL)
+ if ((bit21 && !ud21) ||
+ (!bit21 && !ud))
return 0;
- if (ioctl(fd, PIO_UNIMAP, ud)) {
+ if (bit21) {
+ if (ioctl(fd, PIO_UNIMAP21, ud21)) {
+ if (errno == ENOMEM && advice.advised_hashlevel < 100) {
+ advice.advised_hashlevel++;
+ goto again;
+ }
+#ifdef ENOIOCTLCMD
+ if (errno == ENOIOCTLCMD)
+ errno = EINVAL; /* 21-bit Unicode table
+ * invalid for older kernel */
+#endif
+ KFONT_ERR(ctx, "ioctl(PIO_UNIMAP21): %m");
+ return -1;
+ }
+ }
+ else if (ioctl(fd, PIO_UNIMAP, ud)) {
if (errno == ENOMEM && advice.advised_hashlevel < 100) {
advice.advised_hashlevel++;
goto again;
diff --git a/src/libkfont/loadunimap.c b/src/libkfont/loadunimap.c
index e2cfa05..06015c5 100644
--- a/src/libkfont/loadunimap.c
+++ b/src/libkfont/loadunimap.c
@@ -281,7 +281,8 @@ kfont_load_unicodemap(struct kfont_context *ctx, int fd, const char *tblname)
} else {
descr.entry_ct = listct;
descr.entries = list;
- if ((ret = kfont_put_unicodemap(ctx, fd, NULL, &descr)) < 0)
+ if ((ret = kfont_put_unicodemap(ctx, fd, NULL, 0, &descr,
+ NULL)) < 0)
goto err;
listct = 0;
}
diff --git a/src/libkfont/psffontop.c b/src/libkfont/psffontop.c
index 3f94028..179a271 100644
--- a/src/libkfont/psffontop.c
+++ b/src/libkfont/psffontop.c
@@ -147,7 +147,7 @@ read_fontfile(struct kfont_context *ctx, FILE *fontf, unsigned char **inputbuf,
{
unsigned char *buf = NULL;
unsigned int buflth = 0;
- unsigned int chunksz = MAXFONTSIZE / 4; /* random */
+ unsigned int chunksz = MAXFONTSIZE / 4; /* 1 MB; random */
int ret = 0;
size_t n = 0;
@@ -174,12 +174,6 @@ read_fontfile(struct kfont_context *ctx, FILE *fontf, unsigned char **inputbuf,
ret = -EX_DATAERR;
goto end;
}
-
- if (n > MAXFONTSIZE) {
- KFONT_ERR(ctx, _("Font is too big"));
- ret = -EX_DATAERR;
- goto end;
- }
}
*inputbuf = buf;
@@ -197,12 +191,14 @@ kfont_read_psffont(struct kfont_context *ctx,
unsigned char **fontbufp, unsigned int *fontszp,
unsigned int *fontwidthp, unsigned int *fontheightp,
unsigned int *fontlenp, unsigned int fontpos0,
- struct unicode_list **uclistheadsp)
+ struct unicode_list **uclistheadsp,
+ int *bit21)
{
unsigned char *inputbuf;
unsigned int inputlth;
int ret;
+ *bit21 = 0;
/*
* We used to look at the length of the input file
* with stat(); now that we accept compressed files,
@@ -225,7 +221,8 @@ kfont_read_psffont(struct kfont_context *ctx,
inputlth = *allszp;
}
- unsigned int fontlen, fontwidth, fontheight, charsize, hastable, ftoffset;
+ unsigned int fontlen, fontwidth, fontheight, charsize, hastable,
+ ftoffset;
int utf8;
if (inputlth >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(inputbuf)) {
@@ -317,11 +314,29 @@ kfont_read_psffont(struct kfont_context *ctx,
inptr = inputbuf + ftoffset + fontlen * charsize;
endptr = inputbuf + inputlth;
+ if (fontlen > 0xffff)
+ *bit21 = 1;
for (i = 0; i < fontlen; i++) {
ret = get_uni_entry(ctx, &inptr, &endptr,
&(*uclistheadsp)[fontpos0 + i], utf8);
if (ret < 0)
return ret;
+ {
+ struct unicode_list *list = &(*uclistheadsp)[fontpos0 + i];
+ struct unicode_seq *seq;
+
+ while (list) {
+ seq = list->seq;
+ while (seq) {
+ if (seq->uc > 0xffff)
+ *bit21 = 1;
+ seq = seq->next;
+ }
+ list = list->prev;
+ if (list == &(*uclistheadsp)[fontpos0 + i])
+ break;
+ }
+ }
}
if (inptr != endptr) {
KFONT_ERR(ctx, _("Input file: trailing garbage"));
diff --git a/src/libkfont/setfont.c b/src/libkfont/setfont.c
index 45652c0..f6f0560 100644
--- a/src/libkfont/setfont.c
+++ b/src/libkfont/setfont.c
@@ -185,21 +185,25 @@ err:
static int
do_loadfont(struct kfont_context *ctx, int fd, const unsigned char *inbuf,
unsigned int width, unsigned int height, unsigned int hwunit,
- unsigned int fontsize, const char *filename)
+ unsigned int fontsize, const char *filename)
{
if (height <= 32 && width <= 32)
/* This can work with pre-6.2 kernels and its size and vpitch limitations */
- return try_loadfont(ctx, fd, inbuf, width, height, 32, hwunit, fontsize, filename);
+ return try_loadfont(ctx, fd, inbuf, width, height, 32, hwunit,
+ fontsize, filename);
else
- return try_loadfont(ctx, fd, inbuf, width, height, height, hwunit, fontsize, filename);
+ return try_loadfont(ctx, fd, inbuf, width, height, height,
+ hwunit, fontsize, filename);
}
static int
do_loadtable(struct kfont_context *ctx, int fd, struct unicode_list *uclistheads,
- unsigned int fontsize)
+ unsigned int fontsize, int bit21)
{
struct unimapdesc ud;
struct unipair *up = NULL;
+ struct unimapdesc21 ud21;
+ struct unipair21 *up21 = NULL;
unsigned int i, ct = 0, maxct;
struct unicode_list *ul;
struct unicode_seq *us;
@@ -215,11 +219,19 @@ do_loadtable(struct kfont_context *ctx, int fd, struct unicode_list *uclistheads
ul = ul->next;
}
}
-
- up = malloc(maxct * sizeof(*up));
- if (!up) {
- KFONT_ERR(ctx, "malloc: %m");
- return -EX_OSERR;
+ if (bit21) {
+ up21 = malloc(maxct * sizeof(*up21));
+ if (!up21) {
+ KFONT_ERR(ctx, "malloc: %m");
+ return -EX_OSERR;
+ }
+ }
+ else {
+ up = malloc(maxct * sizeof(*up));
+ if (!up) {
+ KFONT_ERR(ctx, "malloc: %m");
+ return -EX_OSERR;
+ }
}
for (i = 0; i < fontsize; i++) {
@@ -229,8 +241,14 @@ do_loadtable(struct kfont_context *ctx, int fd, struct unicode_list *uclistheads
while (ul) {
us = ul->seq;
if (us && !us->next) {
- up[ct].unicode = (unsigned short) us->uc;
- up[ct].fontpos = (unsigned short) i;
+ if (bit21) {
+ up21[ct].unicode = (unsigned) us->uc;
+ up21[ct].fontpos = (unsigned) i;
+ }
+ else {
+ up[ct].unicode = (unsigned short) us->uc;
+ up[ct].fontpos = (unsigned short) i;
+ }
ct++;
if (ctx->verbose > 1)
printf(" %04x", us->uc);
@@ -250,7 +268,7 @@ do_loadtable(struct kfont_context *ctx, int fd, struct unicode_list *uclistheads
printf("\n");
}
- if (ct > USHRT_MAX || ct != maxct) {
+ if (ct != maxct) {
KFONT_ERR(ctx, _("bug in do_loadtable"));
ret = -EX_SOFTWARE;
goto err;
@@ -258,17 +276,26 @@ do_loadtable(struct kfont_context *ctx, int fd, struct unicode_list *uclistheads
KFONT_INFO(ctx, _("Loading Unicode mapping table..."));
- ud.entry_ct = (unsigned short) ct;
- ud.entries = up;
+ if (bit21) {
+ ud21.entry_ct = ct;
+ ud21.entries = up21;
+ }
+ else {
+ ud.entry_ct = (unsigned short) ct;
+ ud.entries = up;
+ }
- if (kfont_put_unicodemap(ctx, fd, NULL, &ud) < 0) {
+ if (kfont_put_unicodemap(ctx, fd, NULL, bit21, &ud, &ud21) < 0) {
ret = -EX_OSERR;
goto err;
}
ret = 0;
err:
- free(up);
+ if (bit21)
+ free(up21);
+ else
+ free(up);
return ret;
}
@@ -286,6 +313,7 @@ kfont_load_fonts(struct kfont_context *ctx,
struct kbdfile *fp = NULL;
int i;
int ret = 0;
+ int bit21 = 0;
if (ifilct == 1)
return kfont_load_font(ctx, fd, ifiles[0], iunit, hwunit, no_m, no_u);
@@ -321,12 +349,18 @@ kfont_load_fonts(struct kfont_context *ctx,
if (kfont_read_psffont(ctx, kbdfile_get_file(fp), &inbuf,
&inputlth, &fontbuf, &fontbuflth, &width, &height, &fontsize,
- bigfontsize, no_u ? NULL : &uclistheads)) {
+ bigfontsize, no_u ? NULL : &uclistheads,
+ &bit21)) {
KFONT_ERR(ctx, _("When loading several fonts, all must be psf fonts - %s isn't"),
kbdfile_get_pathname(fp));
ret = -EX_DATAERR;
goto end;
}
+ if (bit21) {
+ KFONT_ERR(ctx, _("Full Unicode fonts aren't (yet) handled by this program."));
+ ret = -EX_DATAERR;
+ goto end;
+ }
if (!height) {
unsigned int bytewidth;
@@ -372,10 +406,10 @@ kfont_load_fonts(struct kfont_context *ctx,
}
ret = do_loadfont(ctx, fd, bigfontbuf, bigwidth, bigheight, hwunit,
- bigfontsize, NULL);
+ bigfontsize, NULL);
if (!ret && uclistheads && !no_u)
- ret = do_loadtable(ctx, fd, uclistheads, bigfontsize);
+ ret = do_loadtable(ctx, fd, uclistheads, bigfontsize, 0);
end:
free(bigfontbuf);
@@ -398,6 +432,7 @@ kfont_load_font(struct kfont_context *ctx, int fd, const char *ifil,
unsigned char *inbuf, *fontbuf;
unsigned int inputlth, fontbuflth, fontsize, offset;
struct unicode_list *uclistheads;
+ int bit21 = 0;
int ret;
if (!(fp = kbdfile_new(NULL))) {
@@ -447,10 +482,13 @@ kfont_load_font(struct kfont_context *ctx, int fd, const char *ifil,
height = 0;
uclistheads = NULL;
- if (!kfont_read_psffont(ctx, kbdfile_get_file(fp), &inbuf, &inputlth,
- &fontbuf, &fontbuflth, &width, &height, &fontsize, 0,
- no_u ? NULL : &uclistheads)) {
-
+ ret = kfont_read_psffont(ctx, kbdfile_get_file(fp), &inbuf, &inputlth,
+ &fontbuf, &fontbuflth, &width, &height, &fontsize, 0,
+ no_u ? NULL : &uclistheads,
+ &bit21) ;
+ if (ret)
+ KFONT_ERR(ctx, "Non-zero RET from kfont_read_psffont: %d, %m\n", ret);
+ else {
/* we've got a psf font */
if (!height) {
unsigned int bytewidth;
@@ -459,12 +497,13 @@ kfont_load_font(struct kfont_context *ctx, int fd, const char *ifil,
}
ret = do_loadfont(ctx, fd, fontbuf, width, height, hwunit,
- fontsize, kbdfile_get_pathname(fp));
+ fontsize, kbdfile_get_pathname(fp));
if (ret < 0)
goto end;
if (uclistheads && !no_u) {
- ret = do_loadtable(ctx, fd, uclistheads, fontsize);
+ ret = do_loadtable(ctx, fd, uclistheads, fontsize,
+ bit21);
if (ret < 0)
goto end;
}
diff --git a/src/psfxtable.c b/src/psfxtable.c
index 9886ad4..2a8fdf4 100644
--- a/src/psfxtable.c
+++ b/src/psfxtable.c
@@ -45,6 +45,7 @@ int main(int argc, char **argv)
unsigned char *inbuf, *fontbuf;
unsigned int inbuflth, fontbuflth;
struct unicode_list *uclistheads = NULL;
+ int bit21 = 0;
setuplocale();
@@ -143,9 +144,12 @@ int main(int argc, char **argv)
kbd_error(EX_CANTCREAT, 0, _("Unable to open file: %s: %m"), otname);
if (kfont_read_psffont(kfont, ifil, &inbuf, &inbuflth, &fontbuf,
- &fontbuflth, &width, &height, &fontlen, 0,
- itab ? NULL : &uclistheads) < 0)
+ &fontbuflth, &width, &height, &fontlen, 0,
+ itab ? NULL : &uclistheads,
+ &bit21) < 0)
kbd_error(EX_DATAERR, 0, _("Bad magic number on %s"), ifname);
+ if (bit21)
+ kbd_error(EX_DATAERR, 0, _("Full Unicode fonts aren't (yet) handled by this program."));
fclose(ifil);
diff --git a/src/readpsfheader.c b/src/readpsfheader.c
index 2d87e59..7c1b406 100644
--- a/src/readpsfheader.c
+++ b/src/readpsfheader.c
@@ -29,6 +29,7 @@ int main(int argc, char **argv)
char *inbuf, *fontbuf;
int inbuflth, fontbuflth;
struct unicode_list *uclistheads = NULL;
+ int bit21 = 0;
const char *short_opts = "hV";
const struct option long_opts[] = {
@@ -73,8 +74,12 @@ int main(int argc, char **argv)
if ((ret = kfont_init(program_invocation_short_name, &kfont)) < 0)
return -ret;
- if (kfont_read_psffont(kfont, f, &inbuf, &inbuflth, &fontbuf, &fontbuflth, &width, &fontlen, 0, &uclistheads) < 0)
+ if (kfont_read_psffont(kfont, f, &inbuf, &inbuflth, &fontbuf,
+ &fontbuflth, &width, &fontlen, 0, &uclistheads,
+ &bit21) < 0)
kbd_error(EX_DATAERR, 0, "Bad magic number");
+ if (bit21)
+ kbd_error(EX_DATAERR, 0, "Full Unicode fonts aren't (yet) handled by this program");
close(f);
diff --git a/src/showconsolefont.c b/src/showconsolefont.c
index 9230e2b..27c04ec 100644
--- a/src/showconsolefont.c
+++ b/src/showconsolefont.c
@@ -36,7 +36,8 @@ leave(struct kfont_context *ctx, int n)
kbd_warning(0, _("failed to restore original translation table"));
n = EXIT_FAILURE;
}
- if (have_ounimap && kfont_put_unicodemap(ctx, fd, NULL, &ounimap)) {
+ if (have_ounimap && kfont_put_unicodemap(ctx, fd, NULL, 0,
+ &ounimap , NULL)) {
kbd_warning(0, _("failed to restore original unimap"));
n = EXIT_FAILURE;
}
@@ -92,7 +93,7 @@ setnewunicodemap(struct kfont_context *ctx, unsigned int *list, int cnt)
for (i = 0; i < cnt; i++)
nunimap.entries[list[i]].unicode = (unsigned short) (BASE + i);
- if (kfont_put_unicodemap(ctx, fd, NULL, &nunimap))
+ if (kfont_put_unicodemap(ctx, fd, NULL, 0, &nunimap, NULL))
leave(ctx, EXIT_FAILURE);
}
@@ -111,7 +112,7 @@ usage(int rc, const struct kbd_help *options)
int main(int argc, char **argv)
{
int c, ret;
- unsigned int cols, rows, nr, n, i, j, k;
+ int cols = 0, rows = 0, nr = 0, n, i, j, k;
int mode;
const char *space, *sep;
char *console = NULL;
@@ -176,19 +177,22 @@ int main(int argc, char **argv)
kbd_warning(errno, _("Unable to read keyboard mode"));
leave(kfont, EX_OSERR);
}
- if (mode == K_UNICODE)
- space = "\xef\x80\xa0"; /* U+F020 (direct-to-font space) */
- else
- space = " ";
-
- if (info) {
- nr = rows = cols = 0;
-
- ret = kfont_get_font(kfont, fd, NULL, &nr, &rows, &cols, NULL);
- if (ret != 0)
- leave(kfont, EXIT_FAILURE);
-
- if (kfont_get_verbosity(kfont)) {
+ /* TEMP COMMENTED OUT STUFF, 2026-05-20. What is this F020 for? */
+ /* if (mode == K_UNICODE) */
+ /* space = "\xef\x80\xa0"; /\* U+F020 (direct-to-font space) *\/ */
+ /* else */
+ /* END OF TC STUFF */
+ space = " ";
+
+ ret = kfont_get_font(kfont, fd, NULL, &nr, &rows, &cols, NULL);
+ if (ret != 0)
+ leave(kfont, EXIT_FAILURE);
+
+ if (!info && nr > 512)
+ printf(_("Too many characters to print individually\n"));
+ if (info || nr > 512) {
+ if (kfont_get_verbosity(kfont)
+ || (!info && nr > 512)) {
printf(_("Character count: %u\n"), nr);
printf(_("Font width : %u\n"), rows);
printf(_("Font height : %u\n"), cols);
--
Alan Mackenzie (Nuremberg, Germany).
[-- Attachment #2: latn-16-unifont-base+upper.psfu.gz --]
[-- Type: application/gzip, Size: 86935 bytes --]
[-- Attachment #3: setfont --]
[-- Type: application/octet-stream, Size: 83048 bytes --]
next reply other threads:[~2026-08-27 18:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 18:38 Alan Mackenzie [this message]
2026-08-27 18:42 ` [Patch 1/9]: Make consolemap.c handle Unicode planes outside BMP Alan Mackenzie
2026-08-28 4:57 ` Jiri Slaby
2026-08-27 18:45 ` [Patch 2/9]: Glyph size: Use GLYPH_SZ/HW rather than hardcoded 2, 1 Alan Mackenzie
2026-08-27 18:47 ` [Patch 3/9]: Replace scr_readw/writew by scr_readg/writeg, etc Alan Mackenzie
2026-08-27 18:48 ` [Patch 4/9]: Amend internal manipulation of glyph structure Alan Mackenzie
2026-08-27 18:50 ` [Patch 5/9]: vt: Amend three Kconfig files Alan Mackenzie
2026-08-27 18:52 ` [Patch 6/9]: vt: Use u32 and typedef u1632 to handle whole glyphs Alan Mackenzie
2026-08-27 18:54 ` [Patch 7/9]: vt: Handle up to 2^21 glyphs, rather than 256/512 Alan Mackenzie
2026-08-27 18:56 ` [Patch 8/9]: vt: Enhancements to the VT ioctl interface Alan Mackenzie
2026-08-27 18:58 ` [Patch 9/9]: vt: Misc changes, e.g. to #include directives Alan Mackenzie
2026-08-28 6:12 ` vt: Enlarge the framebuffer glyph size from 16 to 32 bits Thomas Zimmermann
2026-08-28 14:36 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=apCEDM2sWv_M354-@MAC.fritz.box \
--to=acm@muc.de \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®