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

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 21 Oct 2021 04:11:56 +0200

Robert Pluim <[email-masked]> writes:

> Iʼve installed the fonts in question, and I can reproduce the
> issue. What I see:
>
> - the GTK font selector lets us choose 'Operator Mono Book'
> - the resulting weight according to Pango is '330', which we map to
>   'normal' [1]

Selecting Operator Mono Light reports back a weight of 300 (which is
according to spec).

Book reports 330 (but should be 380).

Medium reports 350 (but should be 500).

Bold reports 400 (but should be 700).

So for this font, the PangoWeights returned by the Gtk selector are
totally out of whack with the spec in pango-font.h.  So I'm wondering
whether this font is just buggy.

I'm trying to compare with what other programs are displaying.  It would
be convenient to test with a program that understands fonts on the
command line, but if I say

xfce4-terminal --font "Operator Mono SSm:weight=book"

then I get something that looks very wrong indeed.  Anybody know a
program that understands these things?

> I then cavalierly hardcoded the weight we request to '200', which
> results in us asking for 'light', and then we correctly use the 'Book'
> version of the font.
>
> This means we should adjust XG_WEIGHT_TO_SYMBOL. It currently assigns
> anything in the range <100-200] to 'light', which just seems wrong. It
> all depends whether the fixed values are the start or the end of the
> range, but would it not make more sense to have 'light' be used for
> the range [300-350> which corresponds to
> [PANGO_WEIGHT_LIGHT-PANGO_WEIGHT_SEMILIGHT> ? [2]

Well,

  PANGO_WEIGHT_THIN = 100,

and

  PANGO_WEIGHT_ULTRAHEAVY = 1000

so it kinda sounds like <=, not >= is the intended semantic (which is
what Emacs does).

> [2]  Iʼll note that 'w32_to_fc_weight' uses the various FW_* constants
>      as the start of the respective range, not the end

Hm...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no