From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#32210: Support medium weighted fonts Date: Sun, 17 Nov 2019 19:54:08 +0200 Message-ID: <835zji5qyn.fsf@gnu.org> References: <87v9riaofa.fsf@gnus.org> <83pnhq5w92.fsf@gnu.org> <87lfse5t5g.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="145529"; mail-complaints-to="usenet@blaine.gmane.org" Cc: carlosjosepita@gmail.com, 32210@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 17 18:55:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWOlT-000bdn-K4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 18:55:11 +0100 Original-Received: from localhost ([::1]:55316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWOlS-0002y0-8l for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 12:55:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42742) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWOlL-0002wT-AL for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:55:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWOlJ-0007vF-UV for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:55:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33710) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWOlJ-0007uS-RC for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:55:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWOlJ-0003bV-L7 for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Nov 2019 17:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32210 X-GNU-PR-Package: emacs Original-Received: via spool by 32210-submit@debbugs.gnu.org id=B32210.157401326113797 (code B ref 32210); Sun, 17 Nov 2019 17:55:01 +0000 Original-Received: (at 32210) by debbugs.gnu.org; 17 Nov 2019 17:54:21 +0000 Original-Received: from localhost ([127.0.0.1]:42531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWOkc-0003aP-6f for submit@debbugs.gnu.org; Sun, 17 Nov 2019 12:54:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWOkZ-0003aA-Ip for 32210@debbugs.gnu.org; Sun, 17 Nov 2019 12:54:16 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iWOkU-00070Q-4C; Sun, 17 Nov 2019 12:54:10 -0500 Original-Received: from [176.228.60.248] (port=2526 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iWOkS-0007Y6-Lr; Sun, 17 Nov 2019 12:54:09 -0500 In-reply-to: <87lfse5t5g.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 17 Nov 2019 18:06:51 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171828 Archived-At: > From: Lars Ingebrigtsen > Cc: carlosjosepita@gmail.com, 32210@debbugs.gnu.org > Date: Sun, 17 Nov 2019 18:06:51 +0100 > > #define XG_WEIGHT_TO_SYMBOL(w) \ > (w <= PANGO_WEIGHT_THIN ? Qextra_light \ > : w <= PANGO_WEIGHT_ULTRALIGHT ? Qlight \ > : w <= PANGO_WEIGHT_LIGHT ? Qsemi_light \ > : w < PANGO_WEIGHT_MEDIUM ? Qnormal \ > : w <= PANGO_WEIGHT_SEMIBOLD ? Qsemi_bold \ > : w <= PANGO_WEIGHT_BOLD ? Qbold \ > : w <= PANGO_WEIGHT_HEAVY ? Qextra_bold \ > : Qultra_bold) > > If we look at > > https://abi-laboratory.pro/?view=headers_diff&l=pango&v1=1.36.5&v2=1.36.6 > > we find > > * @PANGO_WEIGHT_NORMAL: the default weight (= 400) > * @PANGO_WEIGHT_MEDIUM: the normal weight (= 500; Since: 1.24) For more amusement, see https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createfonta Who copycats whom? > so Pando has also grown a MEDIUM in addition to NORMAL... and we don't > have PANGO_WEIGHT_NORMAL. A related question is: can the GTK font selection dialog return PANGO_WEIGHT_MEDIUM (when you choose a font with that weight)? > > And there are other places in the sources that only support subsets of > > all the weights. If we want to make them more fine-grained, we should > > make them all consistent, as much as possible, modulo the limitations > > of the toolkit. > > Yup. > > > For example, Someoneā„¢ should verify that the problem described above > > is not some inherent GTK limitation. > > If we look at > > https://emacs.stackexchange.com/questions/32377/selecting-correct-font-weight-variant-linux > > people seem to be instructing Emacs to use the sizes adjacent to Emacs > normal/medium to actually get the weights they want, and then it works. > Also see bug#28351 (which I've merged with this one). I think there's still more to this. From reading various parts of font.c I get the impression that Fontconfig supports only a subset of the above values. Or maybe it did in the past, when font.c was coded, and nowadays supports more? Also see the node "Fonts" n the user manual, where it describes no less than 4 different methods of specifying a font, each one with a different repertoire of "weight" values. So not only the toolkit matters here, but also the font configuration back-end (Fontconfig and FreeType on Posix platforms) etc., and we use different font specifications in different commands, which sometimes exposes the differences. We need to bring them all to the common denominator, and it has to be not the lowest one. > But is this something we want to tweak before Emacs 27, or should it > wait for Emacs 28? It depends what kind of tweaking will be needed. If we just need to change a bunch of constants and augment several switch statements that convert between representations, it might be safe enough for Emacs 27. E.g., see the change I just installed in w32font.c for bug#24226.