Subject: Re: bug#51277: 27.1; menu-set-font not loading correct font

From: Robert Pluim <[email-masked]>
Date: Thu, 21 Oct 2021 17:37:55 +0200

>>>>> On Thu, 21 Oct 2021 14:59:14 +0200, Lars Ingebrigtsen <[email-masked]> said:

    Lars> Robert Pluim <[email-masked]> writes:
    Lars> then I get something that looks very wrong indeed.  Anybody know a
    Lars> program that understands these things?
    >> 
    >> FC_DEBUG=1 xfce4-terminal --font "Operator Mono SSm:weight=book"
    >> 
    >> will get you fontconfig debug telling you which actual font is
    >> used.

    Lars> Yeah, but surely there must be some other program (other than Emacs)
    Lars> that actually uses this syntax for specifying fonts?  I thought it was
    Lars> supposed to be...  "the way"...

Dunno. Specifying fonts on the command line is apparently passé.

    >> gedit rounds down to the nearest multiple of 100, which equates to >=

    Lars> Huh.

    >> I guess the root cause of all of this is that weʼre mapping
    >> PangoWeights to symbolic constants, which we then pass to
    >> fontconfig. Perhaps we could arrange to pass the weights directly?

    Lars> Indeed, the Pango round trip through symbols is inherently breakable.  I
    Lars> mean, the Gtk chooser knows exactly what font I've selected -- but is
    Lars> there any way to get it to cough up that instead of the Pango weights?

I donʼt think so: Pango is supposed to abstract away from all that.

    Lars> I've looked at the documentation

    Lars> https://docs.gtk.org/Pango/struct.FontDescription.html

    Lars> and nothing really jumped out at me.  I mean, in this case, Pango
    Lars> reports a weight of 330 for book...  but the actual weight in the file is: 

    Lars>         weight: 53(f)(s)

    Lars> So after mapping to symbols and back again, we'll never find that font
    Lars> (because "book" is at 80).

    Lars> But...  what does (f)(s) mean here?

Type double with a strong binding. I once knew what the distinction is
between strong/weak, but like all things fontconfig that knowledge
tends to disappear.

Robert
--