On Sun 20 Oct 2024 at 16:01:43 -0700, Greg A. Woods wrote:
> However I have only briefly, and using magic I did not understand or
> correctly record, managed to get the font in the Identify and About
> windows to scale properly.

Concentrating on the Identify window, I looked though the source and
this is what I found. It is drawn in functions_identify.c
draw_info_window() where it calls

XmbDrawString(dpy, Scr->InfoWindow.win, Scr->DefaultFont.font_set,

So where is DefaultFont set? In util.c there is

CreateFonts(ScreenInfo *scr)
{
#define LOADFONT(fld) (GetFont(&scr->fld##Font))
...
    LOADFONT(Default);

GetFont() uses

    char *deffontname = "fixed,*";

    asprintf(&basename2, "%s,*", font->basename);
    if((font->font_set = XCreateFontSet(dpy, basename2, ...

        fprintf(stderr, "Failed to get fontset %s\n", basename2);

        if(Scr->DefaultFont.basename) {
            deffontname = Scr->DefaultFont.basename;
        }

        if((font->font_set = XCreateFontSet(dpy, deffontname,

but Scr->DefaultFont.basename never seems to be set anywhere (unlike, for
example,  TitleBarFont.basename).

So it looks like those windows will always use the font named "fixed".
(or a FontSet based on that; I never looked much at FontSets much
really)

I don't know if that somehow can automatically scale with the DPI.  But
it sounds like it would be nice to make it configurable anyway. I see in
your dotfiles repo that you already realised that setting DefaultFont is
missing, so I must guess that the fix you mentioned must have helped
here. For others, if they want, they can try the following patch which I
am considering to commit. I gave it a quick test and it appears to work:


=== modified file 'doc/manual/ctwm.1.adoc'
--- old/doc/manual/ctwm.1.adoc  2022-12-15 03:08:02 +0000
+++ new/doc/manual/ctwm.1.adoc  2024-10-21 15:02:49 +0000
@@ -755,6 +755,10 @@
   This variable specifies the background color to be used for sizing and
   information windows.  The default is ``white''.
 
+DefaultFont `string`::
+  This variable specifies the font to be used in the Info and About windows,
+  and as a general fallback font.  The default is ``fixed''.
+
 DefaultForeground `string`::
   This variable specifies the foreground color to be used for sizing and
   information windows.  The default is ``black''.

=== modified file 'parse_be.c'
--- old/parse_be.c      2022-11-05 01:32:18 +0000
+++ new/parse_be.c      2024-10-21 14:55:08 +0000
@@ -153,6 +153,7 @@
 #define kws_IconifyStyle                19
 #define kws_IconSize                    20
 #define kws_RplaySoundHost              21
+#define kws_DefaultFont                 22
 
 #define kwss_RandomPlacement            1
 
@@ -267,6 +268,7 @@
        { "darkshadowcontrast",     NKEYWORD, kwn_DarkShadowContrast },
        { "decoratetransients",     KEYWORD, kw0_DecorateTransients },
        { "defaultbackground",      CKEYWORD, kwc_DefaultBackground },
+       { "defaultfont",            SKEYWORD, kws_DefaultFont },
        { "defaultforeground",      CKEYWORD, kwc_DefaultForeground },
        { "defaultfunction",        DEFAULT_FUNCTION, 0 },
        { "deiconifyfunction",      DEICONIFY_FUNCTION, 0 },
@@ -969,6 +971,12 @@
                        return true;
                }
 
+               case kws_DefaultFont:
+                       if(!Scr->HaveFonts) {
+                               Scr->DefaultFont.basename = s;
+                       }
+                       return true;
+
                case kws_IconFont:
                        if(!Scr->HaveFonts) {
                                Scr->IconFont.basename = s;


-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose

Attachment: signature.asc
Description: PGP signature

Reply via email to