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#73730: 31.0.50; Support for color fonts on MS-Windows Date: Sun, 20 Oct 2024 19:17:10 +0300 Message-ID: <86cyjuiwah.fsf@gnu.org> References: <36a6b4d5-c719-44d6-957d-bcd7db5a854b@imayhem.com> <86o73s14x5.fsf@gnu.org> <0a0c622c-5b69-4f30-94b1-67a238e124b4@imayhem.com> <861q0gqpkf.fsf@gnu.org> <0d2238ff-5cf9-4ba7-97ab-11b76892198d@imayhem.com> <86bjzjp7vv.fsf@gnu.org> <80dc50bd-b2d4-4d21-ad38-322412588b3b@imayhem.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31350"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73730@debbugs.gnu.org, kbrown@cornell.edu To: Cecilio Pardo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 20 18:18:07 2024 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 1t2Yd5-00080t-3s for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Oct 2024 18:18:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2Yce-0007wC-OP; Sun, 20 Oct 2024 12:17:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2Ycb-0007vh-J2 for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2024 12:17:37 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2Ycb-0007bG-4W for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2024 12:17:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=ofZ6jkY+iPIlEpBHh6GUG4LmtzHyQMLFrd3oyvn7N5g=; b=jo37zGS7RbSHfOf5AjKPz9ythgjczqrVWU0MUAgEQJe2oE/Enwp6EVz9CwM47MKZU818VBeXqawKJuwRxM8RCSkCAf2zKRXdX55QJG3fochw96snu3pmMwbQ+gmORpjxopcXjyH/O0tfhbILi/59paCMHB/df6gQ3AI7kQdRLLuy0ziQyoj/+xVCJTa730vMl68yDVh7jo8EbpHQDYgoTbV0VCeqPeFzqtBFS+yVAqs5ppD10GobEQNr/UUOHPThLGF3UbdEObonNMazfZnlSY4yZLTRWU49aRp69OVDJOH1O2KdlURe0GwUPC8nb5A/jslaQr9FBNjr6vjSVqOzsw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2Yd0-0008Jb-Az for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2024 12:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Oct 2024 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73730 X-GNU-PR-Package: emacs Original-Received: via spool by 73730-submit@debbugs.gnu.org id=B73730.172944107331946 (code B ref 73730); Sun, 20 Oct 2024 16:18:02 +0000 Original-Received: (at 73730) by debbugs.gnu.org; 20 Oct 2024 16:17:53 +0000 Original-Received: from localhost ([127.0.0.1]:48240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2Ycr-0008J7-8i for submit@debbugs.gnu.org; Sun, 20 Oct 2024 12:17:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2Yck-0008Ip-Vv for 73730@debbugs.gnu.org; Sun, 20 Oct 2024 12:17:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2YcF-0007ZI-Ea; Sun, 20 Oct 2024 12:17:15 -0400 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=ofZ6jkY+iPIlEpBHh6GUG4LmtzHyQMLFrd3oyvn7N5g=; b=mTceuxPl8N3z P7mPaAzMTfD3x0p+qUu85g3pafR9YcDZnE4SVIJ4xBkfamMILehRWgt+WNx+yBtG6+04AADTqupaQ 5r+FKUnDdCGE2LNi2uZ3pNXZT9f0//j4xWvsmJoSq/oIbx6bP+EZudZohnen7Eb6gUXjM8m/ZVT01 M28ZjHRptzNnP463WRhCbPBlCcFnpFeEb82IbnVaX2lQbhczYkvqcvEbI13JvBqE0YbQPFDQN2tso U0pRx6GqDPdcjEwuf/9COLyDM6nsyqethSfvzOIchXjpZu1WxP2MB6nBexdo/HuwcAVcw0gdLHY6o ZrH6xAqzM5OwNm+YWv+vlw==; In-Reply-To: <80dc50bd-b2d4-4d21-ad38-322412588b3b@imayhem.com> (message from Cecilio Pardo on Sun, 20 Oct 2024 15:35:10 +0200) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293984 Archived-At: > Date: Sun, 20 Oct 2024 15:35:10 +0200 > From: Cecilio Pardo > Cc: 73730@debbugs.gnu.org, kbrown@cornell.edu > > The error is caused indeed by fonts with size == 0. > > - w32-find-non-USB-fonts calls open-font with size == nil. > - open-font gets the size from font-entity, that is also empty. > - It ends up calling CreateFontIndirect with a LOGFONT > with lfHeight == 0 > - Then, w32-find-non-USB-fonts calls font-get-glyphs, which call > text_extents. > - text_extents on DirectWrite fails with a font of size 0, but > w32font_text_extents does return values that are not 0. > > If the case of size <= 0, we are now falling back to > w32font_text_extents. Maybe it's better to use some default size in text_extents instead? The pixel size of the default font is known (see FRAME_LINE_HEIGHT), so maybe just use it if you get a font of size zero? That could be a more future-proof fix, since we could get such fonts in other situations as well. Regardless, we should keep the strategy of falling back to the old code if DirectWrite fails. Thanks.