Hi tech@,

Here is a diff to add a new column to wsfontload -l output, which
reports the number of characters contained in a loaded font.

It's especially useful with user loaded fonts as they can contain more
than 256 characters.

Below is the current output of wsfontload -l, without the diff:

# Name                             Encoding  W  H
 0 Boldface                              ibm  8 16
 1 Spleen 6x12                           iso  6 12
 2 Spleen 8x16                           iso  8 16
 3 Spleen 12x24                          iso 12 24
 4 Spleen 16x32                          iso 16 32
 5 Spleen 32x64                          iso 32 64

And now with the diff:

 # Name                             Encoding    Chars  W  H
 0 Boldface                              ibm      254  8 16
 1 Spleen 6x12                           iso       96  6 12
 2 Spleen 8x16                           iso      224  8 16
 3 Spleen 12x24                          iso      224 12 24
 4 Spleen 16x32                          iso      224 16 32
 5 Spleen 32x64                          iso      224 32 64

Comments? OK?

Index: usr.sbin/wsfontload/wsfontload.c
===================================================================
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
retrieving revision 1.21
diff -u -p -r1.21 wsfontload.c
--- usr.sbin/wsfontload/wsfontload.c    28 Jun 2019 13:32:51 -0000      1.21
+++ usr.sbin/wsfontload/wsfontload.c    16 Jul 2020 16:11:18 -0000
@@ -141,7 +141,8 @@ main(int argc, char *argv[])
 
        if (list) {
                i = 0;
-               p = " # Name                             Encoding  W  H";
+               p = " # Name                             Encoding" \
+                   "    Chars  W  H";
                do {
                        f.index = i;
                        res = ioctl(wsfd, WSDISPLAYIO_LSFONT, &f);
@@ -151,10 +152,11 @@ main(int argc, char *argv[])
                                                puts(p);
                                                p = NULL;
                                        }
-                                       printf("%2d %-32s %8s %2d %2d\n",
+                                       printf("%2d %-32s %8s %8d %2d %2d\n",
                                            f.index, f.name,
                                            encodings[f.encoding].name,
-                                           f.fontwidth, f.fontheight);
+                                           f.numchars, f.fontwidth,
+                                           f.fontheight);
                                }
                        }
                        i++;

Reply via email to