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 13:00:52 +0100 Message-ID: <87k0g2f77n.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> <87o85ef8rg.fsf@wavexx.thregr.org> <83ilvmb0n3.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="20514"; 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 13:07:41 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 1myYV3-00058x-1K for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Dec 2021 13:07:41 +0100 Original-Received: from localhost ([::1]:45264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myYV1-0008Ff-Gm for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Dec 2021 07:07:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myYTv-0007Wa-JE for emacs-devel@gnu.org; Sat, 18 Dec 2021 07:06:32 -0500 Original-Received: from [2001:41c9:1:41f::63] (port=37432 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 1myYTq-0003cs-Q7; Sat, 18 Dec 2021 07:06:31 -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 1myYU1-001krt-9W (envelope-from ); Sat, 18 Dec 2021 13:06:37 +0100 In-reply-to: <83ilvmb0n3.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:282286 Archived-At: On Sat, Dec 18 2021, Eli Zaretskii wrote: >> 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? > > Yes. Just out of curiosity, if you happen to know it, how does the "custom" machinery does this then regarding to faces? It it also done in a frame hook? As it looks like we're able to alter the face colors/parameters/inheritance at will, but still have to delay setting the font family until the frame is setup. This is kind of ugly. > You could use a simple flag variable for that. Regarding that... > Welcome to the club. The code which selects fonts in Emacs is quite > complex and notoriously under-documented. On top of that, we don't > have any experts on board who are familiar with that code and can > readily answer questions such as this one. The only way to > investigate is to step through the code, starting in xfaces.c (where > we process set-face-attribute), and following into font.c and > fontset.c, where the font selection actually happens. So I now moved the (set-face-attribute 'default nil ...) call to run once after the first frame is created. It works. But for the first frame only (!). When I create a new frame, the second new frame still selects the wrong weight. Duh...