From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Incorrect font weight selected Date: Wed, 05 Jan 2022 19:05:56 +0200 Message-ID: <83ee5m9kp7.fsf@gnu.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> <87y24grwp6.fsf@wavexx.thregr.org> <877dbzo98z.fsf@gnus.org> <83bl1b12b5.fsf@gnu.org> <837dbz112w.fsf@gnu.org> <71a9cd97-02a6-79d7-6af8-b4aef3d1baa8@yandex.ru> <83y24eyww3.fsf@gnu.org> <87wnjyt9yd.fsf@wavexx.thregr.org> <83sfumyr9c.fsf@gnu.org> <877dbe86tv.fsf@wavexx.thregr.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40044"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, emacs-devel@gnu.org, monnier@iro.umontreal.ca, dgutov@yandex.ru To: Yuri D'Elia Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 05 18:09:15 2022 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 1n59ml-000AEu-7E for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Jan 2022 18:09:15 +0100 Original-Received: from localhost ([::1]:60240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n59mj-0001LK-4W for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Jan 2022 12:09:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n59ji-0005gK-4W for emacs-devel@gnu.org; Wed, 05 Jan 2022 12:06:06 -0500 Original-Received: from [2001:470:142:3::e] (port=47214 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n59jP-0004HT-H0; Wed, 05 Jan 2022 12:05:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iiP/VJu+mw0XPs7ZCeGyo8Qgmt4PfxGgCaLjDVgwIsg=; b=LY/2hyI2Oanj 28W68Fi4uWqzJ33v8X9XcspUM4fQqyYQKbR9iVK2OVFrf7qb8rGlISBq6d4x5N1ni7v9rIYhCarXF wZanNkU81IXKllSrD90yW5lGPv9GhEwOhnOaavS5Kgcn2/DO/2MROLry+COl4rZMjpqqZIPB78baU cJnOB35bf6vFiG+RnkvIQhrS51Xk1qSRZ2PlaMuS134MBOLoqtsueBlDSG1QNgbq8/yk+7NCQA/hy gYbTHbo32x8GSKetXgA2HdG1yZXycKnmDyShj8VdBuKxB2wPo8ZEKWTtlnhHo1h7PGYKoP/ppvxtI 4kFK+/kW0+kG3LsGmkpdDQ==; Original-Received: from [87.69.77.57] (port=3952 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n59jP-0006yq-8F; Wed, 05 Jan 2022 12:05:47 -0500 In-Reply-To: <877dbe86tv.fsf@wavexx.thregr.org> (message from Yuri D'Elia on Wed, 05 Jan 2022 17:19:35 +0100) 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:284255 Archived-At: > From: Yuri D'Elia > Cc: dgutov@yandex.ru, monnier@iro.umontreal.ca, larsi@gnus.org, > emacs-devel@gnu.org > Date: Wed, 05 Jan 2022 17:19:35 +0100 > > After looking at this through a couple of times, I came up with the > attached patch. When changing the default face, the resulting font > name/pattern is stored as a string. Whenever a new frame is created, the > string is used to re-open the face again. I guess this is done to > support creating frames across different terminal types preserving the > closest available font. > > This is done by calling font_open_by_name, which builds up a font spec > again from the stored string (which at this point _should_ be fully > specified), then calls the font_open_by_spec. The problem seems that > font_open_by_spec is _explicitly_ requesting a normal > weight/slant/width. So if multiple candidates were available while > enumerating fonts, the regular variant was always picked irregardless of > our preference. > > This used to work before since only a single variant was generally > enumerated. In the patch, instead of just resetting/overriding the spec, > we just preset a normal variant if the spec is incomplete. I included > also the family/foundry in the spec, which can be used during selection > instead of blindly ignoring it. > > This seems to work correctly for me now, however I'm only testing on > x11. font_open_by_name is not used in many places aside frame creation. > This change seems coherent to me looking at the other calls. Thanks, but this is a scary change. I have no idea what unintended consequences it could cause. Can we back up a bit, and understand how the change in 1b2511f triggered the problems you see? If you already understand that, can you describe it? Maybe we could then come up with a safer, better understood change. If nothing better comes to mind, I'd prefer to revert 1b2511f than doing something like what you propose.