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.bugs Subject: bug#52888: 29.0.50; font_{delete_unmatched,score} do not handle nil FONT_WEIGHT_INDEX Date: Sat, 01 Jan 2022 09:15:18 +0200 Message-ID: <83sfu8exkp.fsf@gnu.org> References: <87zgoi8xve.fsf@melete.silentflame.com> <83r19uim2q.fsf@gnu.org> <871r1uyq1i.fsf@athena.silentflame.com> <8335mahr8f.fsf@gnu.org> <87v8z4mh5g.fsf@melete.silentflame.com> <87sfu8mbcm.fsf@melete.silentflame.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4523"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52888@debbugs.gnu.org To: Sean Whitton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 01 08:17:01 2022 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 1n3YdQ-0000yk-R3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Jan 2022 08:17:01 +0100 Original-Received: from localhost ([::1]:42294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n3YdO-0007qw-DA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Jan 2022 02:16:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3YcW-0007qf-7y for bug-gnu-emacs@gnu.org; Sat, 01 Jan 2022 02:16:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46185) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n3YcU-0007mt-Hl for bug-gnu-emacs@gnu.org; Sat, 01 Jan 2022 02:16:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n3YcU-0001lX-Bn for bug-gnu-emacs@gnu.org; Sat, 01 Jan 2022 02:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Jan 2022 07:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52888 X-GNU-PR-Package: emacs Original-Received: via spool by 52888-submit@debbugs.gnu.org id=B52888.16410213276731 (code B ref 52888); Sat, 01 Jan 2022 07:16:02 +0000 Original-Received: (at 52888) by debbugs.gnu.org; 1 Jan 2022 07:15:27 +0000 Original-Received: from localhost ([127.0.0.1]:57731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n3Ybu-0001kU-Uf for submit@debbugs.gnu.org; Sat, 01 Jan 2022 02:15:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n3Ybs-0001kC-NF for 52888@debbugs.gnu.org; Sat, 01 Jan 2022 02:15:25 -0500 Original-Received: from [2001:470:142:3::e] (port=54132 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 1n3Ybn-00072J-GV; Sat, 01 Jan 2022 02:15:19 -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=JudGzijFcTLSa9dWm8fPauiRFmUyhy1uov15H4U4UDU=; b=hvYjkb0y/OAY nJcOwAEzEuoCgaEd2uEjtpXl2SFrjnfNMyWsKqtgu015k5Z9CBw3jNf1feWdfHZDVJRuLEjQZVuOv JOnwYk70oelf/Q0iThifye/JS4PAd+DxVjzb+yf4FN4c6bX1kA0dC+S7ct6Pih1lCCD+I00wPdv+v vJF5PVYmILvPO1Hb0Qp15NZxEZ7nCgn8gpxzEB7YeVqfs2TVkNNJAP7mjRYFsvTyOk7pVENtcgOMK /Rybkrw5HhakStppFcTSrkAN/AAD3madnfRTIglYlB4CluciB3WswHo1RndYj9Uj7sxITlfixqHnu CRslYdPtwTlNEe3fpw7YTg==; Original-Received: from [87.69.77.57] (port=1502 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 1n3Ybn-0000LT-Fv; Sat, 01 Jan 2022 02:15:19 -0500 In-Reply-To: <87sfu8mbcm.fsf@melete.silentflame.com> (message from Sean Whitton on Fri, 31 Dec 2021 19:35:53 -0700) 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:223495 Archived-At: > From: Sean Whitton > Date: Fri, 31 Dec 2021 19:35:53 -0700 > > > if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) > > { > > FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, make_fixnum (numeric)); > > } > > ... or FcPatternGetInteger returns something other than FcResultMatch, > which is in fact what is happening. > > I tried FcPatternGetDouble in an else branch and that fails too, so it > seems fontconfig cannot determine a weight for the variant in question. > > So, perhaps each of the if (FcPatternGetInteger (...)) conditionals that > corresponds to one of the FONT_* fields that the font.c functions assume > are fixnums should have an else branch to return Qnil? Maybe. However, the question that I think we should ask ourselves at this point is whether there's a reasonable way to process these fonts into a font spec that Emacs expects. So if FcPatternGetInteger and FcPatternGetDouble don't do the job, perhaps there's another fontconfig function that does, or maybe these fonts need to be processed in some slightly different ways (like in a loop, for example) to produce the weight matches from them? Can you perhaps ask the developers of this font to help? Or maybe we could ask on the fontconfig forum? If it turns out that there's no way we could adapt our code to these fonts (which I'd find hard to believe), we should then look for a way of detecting them so that we could reject them on the font backend level, before they get into the platform-independent code in font.c, e.g. with the 'else' branch that you suggest. However, I suspect that the fact we don't have such branches is not just because we blindly assume that can "never happen", so maybe doing so would break something. In any case, trying to accept those fonts instead of rejecting them would be a better solution, if we can reasonably code it. Thanks.