From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#51277: 27.1; menu-set-font not loading correct font Date: Wed, 20 Oct 2021 17:02:23 +0200 Message-ID: <87ee8f3fk0.fsf@gmail.com> References: <83a6j5chh9.fsf@gnu.org> <837de9c8hf.fsf@gnu.org> <83y26oc491.fsf@gnu.org> <83v91sc25x.fsf@gnu.org> <87zgr42i78.fsf@gmail.com> <83cznzc1p8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9622"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jesse Sheidlower , 51277@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 20 17:06:01 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdDAG-0002G3-Px for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Oct 2021 17:06:00 +0200 Original-Received: from localhost ([::1]:32944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdDAC-0002vk-GU for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Oct 2021 11:05:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdD7R-0008QR-EM for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2021 11:03:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdD7O-0004Ja-CQ for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2021 11:03:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mdD7O-0008HA-9P for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2021 11:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2021 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51277 X-GNU-PR-Package: emacs Original-Received: via spool by 51277-submit@debbugs.gnu.org id=B51277.163474215331192 (code B ref 51277); Wed, 20 Oct 2021 15:03:02 +0000 Original-Received: (at 51277) by debbugs.gnu.org; 20 Oct 2021 15:02:33 +0000 Original-Received: from localhost ([127.0.0.1]:55147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdD6v-00086b-9F for submit@debbugs.gnu.org; Wed, 20 Oct 2021 11:02:33 -0400 Original-Received: from mail-wm1-f52.google.com ([209.85.128.52]:40754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdD6t-00081e-O2 for 51277@debbugs.gnu.org; Wed, 20 Oct 2021 11:02:32 -0400 Original-Received: by mail-wm1-f52.google.com with SMTP id 186-20020a1c01c3000000b0030d8315b593so2380041wmb.5 for <51277@debbugs.gnu.org>; Wed, 20 Oct 2021 08:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=5Zr927EUJ3V3xWMEccIuzxsvfmfvg7bUrLWysxqcKQw=; b=mfA4SrO0AwZ5SRWE17bOR5RDw/n9blnlybBBrMMRC0eqWtxh1Nq8JhPPcP0d2fGZJE LO+bZjm0oc3LB9UuQ9yJsLtuDpunzikARSweXO/I/G9WjwaEz/jFoKg7RTVpk9LU9z/5 RChF+s12Hy97iU9j+jg9g2Fkjxl73l3gEnVnq+yzTWYsQuX23J4bLTCSKUPzYphKJz0K txWZzpttCI0mftex8GRKkqXo8ObdWo8zF0Baw+Rd2FbRvESzaiu/XwULsu5KAxRSM1Sv hZ/Kq8UErl0K57120ETgvAbHVQBX8VkfE5ZqloNR4PzDy9fTeyJfsMW2XkleOmC8mVd1 MRcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=5Zr927EUJ3V3xWMEccIuzxsvfmfvg7bUrLWysxqcKQw=; b=BnLbNFe/9AIZZZlGAyCf5ZmsFytFG9+VAy5wPSC8L0E7qAYYrK7d39GMSGGAqXhhZy /qPIJLI9+S1kxYwU3wRxSsCspAKP9d1MWMzFeyEJZakx+kZln/nhkNBFM/2aPOmZd0Ji j5s1+Dm8EzdtKOE6uhVv+rAaIXTl2zpNQooMIPVJDO1BsFJi9ojyHmxwgVF+fEfpE9or Vx9/R/4zwgJ4lTuK7W/vGXkER9tHvj08mMCMXSQJGLmC9+F8rXumnNe2z9WL78sALak6 UbbhxwMmgAgWHTX+iHTyTyg/bOjH8qLyOsmgVghSBE2pTvOSW5m9GFeZgqobg6ls1E3j BKLg== X-Gm-Message-State: AOAM530/JFOkOZyTs17o4dycGmTUQ81Ij1/FjbiNcU1q7XxkO0F7LSE/ V71A5X77xWLYekwGWwAYFtsFO1ikzV4= X-Google-Smtp-Source: ABdhPJwJJoxqRPthGC2PuRz+o/Cf0thKtkAjWX4G67wLRFLJy23OGAjQOxm9Htr4yZ1pSIpUqSOgBQ== X-Received: by 2002:a5d:630b:: with SMTP id i11mr264776wru.65.1634742145341; Wed, 20 Oct 2021 08:02:25 -0700 (PDT) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id k27sm2152042wms.21.2021.10.20.08.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 08:02:24 -0700 (PDT) In-Reply-To: <83cznzc1p8.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 20 Oct 2021 15:36:51 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:217677 Archived-At: >>>>> On Wed, 20 Oct 2021 15:36:51 +0300, Eli Zaretskii said: >> Date: Wed, 20 Oct 2021 07:30:21 -0400 >> From: Jesse Sheidlower >> Cc: Eli Zaretskii , 51277@debbugs.gnu.org >>=20 >> There is no difference in the result: whether I restrict emacs to xf= ont, >> ftfont, or ftcrhb, it still loads the "Bold" file even when I select= the >> "Book" version from menu-set-font. >>=20 >> Where does this leave us? It does still seem like a bug (albeit one = that >> apparently affects very few people). Eli> Are you familiar with debugging with Edebug and/or with running Em= acs Eli> under GDB? If so, perhaps you could step into the relevant code a= nd Eli> tell us what happens there with this font, so we could understand = the Eli> root cause(s) of this. tl;dr font weight handling is a mess Eli> Or maybe someone else who can install that font and sees the probl= em Eli> could do that. I=CA=BCve 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] Comparing that to what 'fc-match' tells us: $ fc-match 'operator mono:weight=3D330' FontsFree-Net-OperatorMono-Bold.ttf: "Operator Mono" "Bold" $ fc-match 'operator mono' FontsFree-Net-OperatorMono-Bold.ttf: "Operator Mono" "Bold" $ fc-match 'operator mono:style=3Dbook' FontsFree-Net-OperatorMono-Book.ttf: "Operator Mono" "Book" $ fc-match 'operator mono:light' FontsFree-Net-OperatorMono-Book.ttf: "Operator Mono" "Book" So I=CA=BCd be willing to point the finger at the font here, except that with gedit, when I select 'Operator Mono Book', I get the 'book' version, not 'bold'. 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] Robert Footnotes: [1] According to the pango headers, 'book' =3D=3D 380 [2] I=CA=BCll note that 'w32_to_fc_weight' uses the various FW_* constants as the start of the respective range, not the end --=20