Alexander Gromnitsky's Blog

Missing charsets in String to FontSet conversion

Latest update:

After upgrading to Fedora 34 I started to get a strange warning when running vintage X11 apps:

$ xclock
Warning: Missing charsets in String to FontSet conversion

With gv(1) it was much worse--multi-line errors, all related to misconfigured fonts. Some errors I was able to fix via

# dnf reinstall xorg-x11-fonts\*

Why exactly rpm post-install scripts have miscarried during the distro upgrade, remains unknown. Still, the main warning about charsets persisted.

Most classic x11 apps (gv included) are written in (now ancient) libXt library. By grepping through libXt code, I found a function that emits the warning in question. It calls XCreateFontSet(3) & dutifully reports the error, but fails to describe which of the charsets weren't found for a particular font.

A simple patch to libXt:

--- libXt-1.2.0/src/Converters.c.save	2021-05-22 00:18:36.359273335 +0300
+++ libXt-1.2.0/src/Converters.c	2021-05-22 00:21:08.550340341 +0300
@@ -973,6 +973,10 @@
                  XtNmissingCharsetList,"cvtStringToFontSet",XtCXtToolkitError,
                  "Missing charsets in String to FontSet conversion",
                  NULL, NULL);
+          fprintf(stderr, "XFontSet fonts: %s\n", fromVal->addr);
+          for (int i = 0; i < missing_charset_count; i++) {
+            fprintf(stderr, "         missing charset: %s\n", missing_charset_list[i]);
+          }
             XFreeStringList(missing_charset_list);
       }
       if (f != NULL) {
@@ -1006,6 +1009,10 @@
              XtCXtToolkitError,
              "Missing charsets in String to FontSet conversion",
                          NULL, NULL);
+                  fprintf(stderr, "XFontSet fonts: %s\n", value.addr);
+                  for (int i = 0; i < missing_charset_count; i++) {
+                    fprintf(stderr, "         missing charset: %s\n", missing_charset_list[i]);
+                  }
           XFreeStringList(missing_charset_list);
               }
               if (f != NULL)
@@ -1030,6 +1036,10 @@
              XtNmissingCharsetList,"cvtStringToFontSet",XtCXtToolkitError,
              "Missing charsets in String to FontSet conversion",
              NULL, NULL);
+      fprintf(stderr, "XFontSet fonts: %s\n", "-*-*-*-R-*-*-*-120-*-*-*-*,*");
+      for (int i = 0; i < missing_charset_count; i++) {
+        fprintf(stderr, "         missing charset: %s\n", missing_charset_list[i]);
+      }
         XFreeStringList(missing_charset_list);
     }
     if (f != NULL)

gave me some clue:

$ gv
Warning: Missing charsets in String to FontSet conversion
...
... missing charset: KSC5601.1987-0

What is KSC5601.1987-0? Looks Korean. Why can't XCreateFontSet(3) suddenly find it? I didn't uninstall any fonts during the distro upgrade.

Turns out, the only bitmap font that provided KSC5601.1987-0 charset, daewoo-misc, was removed from xorg-x11-fonts-misc package due to licensing concerns. This is very rude.

It forced me to make a custom rpm package for daewoo-misc fonts. The spec file is here. Notice that I didn't bother to provide a fontconfig configuration (hence the installed font is invisible to Xft), for all I cared was to silence the annoying gv warning.


Tags: ойті
Authors: ag