From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri D'Elia Newsgroups: gmane.emacs.devel Subject: Re: Incorrect font weight selected Date: Sat, 18 Dec 2021 11:43:25 +0100 Message-ID: <87o85ef8rg.fsf@wavexx.thregr.org> References: <87pmpv708h.fsf@wavexx.thregr.org> <83r1abcb93.fsf@gnu.org> <87y24jqahr.fsf@wavexx.thregr.org> <83ilvnc6z4.fsf@gnu.org> <875yrmyk8q.fsf@wavexx.thregr.org> <83ee6actjj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27914"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.7.5; emacs 29.0.50 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 18 12:34:03 2021 Return-path: Envelope-to: ged-emacs-devel@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 1myXyU-00078U-TO for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Dec 2021 12:34:02 +0100 Original-Received: from localhost ([::1]:50910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myXyT-00085g-7W for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Dec 2021 06:34:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myXxS-00074a-E6 for emacs-devel@gnu.org; Sat, 18 Dec 2021 06:32:58 -0500 Original-Received: from [2001:41c9:1:41f::63] (port=37430 helo=erc.thregr.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myXxQ-0003Px-L7; Sat, 18 Dec 2021 06:32:58 -0500 Original-Received: from [5.170.81.94] (helo=localhost) by erc.thregr.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) id 1myXxb-001kTO-P5 (envelope-from ); Sat, 18 Dec 2021 12:33:08 +0100 In-reply-to: <83ee6actjj.fsf@gnu.org> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:41c9:1:41f::63 (failed) Received-SPF: pass client-ip=2001:41c9:1:41f::63; envelope-from=wavexx@thregr.org; helo=erc.thregr.org X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:282282 Archived-At: On Sat, Dec 18 2021, Eli Zaretskii wrote: >> When I revert commit 1b2511fa2aed460120a36765ba16c14e355eef1d then the >> 'medium weight is selected correctly in both scenarios. > > In a daemon session, you are supposed to put such customizations in > the server-after-make-frame-hook. If you do that, does it work as > expected? Before a GUI frame is created, customizations of faces and > fonts doesn't work as you'd expect because the GUI system may not be > available yet (the frame which the daemon has is basically a surrogate > TTY frame). I understand this, however I really fail to see how this explains the behavior. I would understand if it didn't resolve the font family at all, or it didn't set the correct resolution according to the current fontconfig settings for example, but it does both correctly. Why would it change only the weight selection? I assumed that when setting the default font (by calling set-face-attribute with FRAME set to nil) the actual face selection would be effectively delayed until frame creation time. I guess this is incorrect - i/e font selection is done immediately? > The commit you point to made font selection more lenient wrt medium vs > regular, so I'd be surprised if it prevented some weight selection. I > believe it previously worked for you by sheer luck. As I was adjusting the code to move my setup into an after-make-frame hook, I noticed another subtlety: Assuming the following skeleton: (add-hook 'server-after-make-frame-hook (lambda () (set-face-attribute 'default FRAME ...))) I get different results if FRAME is t or nil. Ideally I'd want nil (default). If I do that, it seems to work correctly. However in such case I'd also need to ensure I call this hook once, not for every frame (the main reason I didn't bother calling this in a make-frame hook) and gets slower as I add frames. If I use "t" to set the current frame only, I get a completely different font size: smaller in fact. However, this only holds if I _never_ set the "default frame". If I evaluate instead: (set-face-attribute 'default nil ...) (set-face-attribute 'default t ...) where "..." is the same face selection. In such case, setting the default frame somewhat alters permanently what setting the current frame will do. The second call to set-face-attribute doesn't give me the smaller face, instead it gives me the same face twice. I'm totally confused as of why this happens.