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#65803: 29.1; Noto Sans Mono CJK JP has doubled-width on Windows Date: Sun, 10 Sep 2023 14:44:39 +0300 Message-ID: <83cyyqs15k.fsf@gnu.org> References: <83wmx0x3hj.fsf@gnu.org> <87wmx0dbn6.fsf@yahoo.com> <834jk3v8ux.fsf@gnu.org> <87wmwzbh5z.fsf@yahoo.com> <83pm2rtmvz.fsf@gnu.org> <87o7iac05e.fsf@yahoo.com> <834jk2txe6.fsf@gnu.org> <87fs3mbnem.fsf@yahoo.com> <831qf6twid.fsf@gnu.org> <877coybmho.fsf@yahoo.com> <83y1heseud.fsf@gnu.org> <8734zmbi1z.fsf@yahoo.com> <83msxusbvb.fsf@gnu.org> <87tts2a2cz.fsf@yahoo.com> <83jzsysbh4.fsf@gnu.org> <87pm2qa1s7.fsf@yahoo.com> <83il8isan2.fsf@gnu.org> <87ledea0oy.fsf@yahoo.com> <83h6o2s97x.fsf@gnu.org> <83fs3ms7dx.fsf@gnu.org> <87h6o29sgm.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22935"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65803@debbugs.gnu.org, shingo.fg8@gmail.com To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 10 13:46:20 2023 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 1qfItQ-0005kP-A3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Sep 2023 13:46:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfIt8-000118-TF; Sun, 10 Sep 2023 07:46:03 -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 1qfIt5-0000z5-EC for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 07:46:00 -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 1qfIt5-0004FS-68 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 07:45:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfIt8-0004Gs-62 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 07:46: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, 10 Sep 2023 11:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65803 X-GNU-PR-Package: emacs Original-Received: via spool by 65803-submit@debbugs.gnu.org id=B65803.169434631916367 (code B ref 65803); Sun, 10 Sep 2023 11:46:02 +0000 Original-Received: (at 65803) by debbugs.gnu.org; 10 Sep 2023 11:45:19 +0000 Original-Received: from localhost ([127.0.0.1]:49156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfIsN-0004Fq-CN for submit@debbugs.gnu.org; Sun, 10 Sep 2023 07:45:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfIsI-0004FW-DL for 65803@debbugs.gnu.org; Sun, 10 Sep 2023 07:45:14 -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 1qfIs9-0003u7-Ko; Sun, 10 Sep 2023 07:45:01 -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=27b6JZoGWfpJPG55KPSbtqwHV/aC1UCcpHZNSyCG1VM=; b=J8Cbg9612hrH z8pvJV2H3JHBb/Vz89CVsmNEPjieApRiSiGzBEah/2afL1T1fRieDRiJcqEXmw2PfugdIjY9eyDQD f15dIou+qdKIQSLpMEv8AbZy7oz7GOPcwGDIMqddbEH6PVe34Syra+IZ8eqRQccoqLnT4l7Lqx7ef c8aFo6D62Eu60tmBXwv0bYmqJB5D1MojhOxsR447a5lvCe/DGPo3q6TaiOiIuZnwyMhK2g2xhir36 Mw3FVPVNdSwg/hXyKeyv95Pm9hOnwCXd2HHcOrZ6pil4t2Xfkelp/av4EO6Ox4O9c/RmSrZ8WUySh Iz547iU1+fYl7GGt1TrrqQ==; In-Reply-To: <87h6o29sgm.fsf@yahoo.com> (message from Po Lu on Sun, 10 Sep 2023 19:29:45 +0800) 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:269951 Archived-At: > From: Po Lu > Cc: 65803@debbugs.gnu.org, shingo.fg8@gmail.com > Date: Sun, 10 Sep 2023 19:29:45 +0800 > > Eli Zaretskii writes: > > > Anyway, I tried to write the code to compute the font average width, > > and found that it's impossible to do reliably on MS-Windows: all the > > font-related functions that return glyph metrics require a "device > > context" argument, which cannot be provided as long as we don't have > > at least one w32 frame. So invocations like > > > > emacs -fn "Arial Unicode MS" > > > > will not work, and that means invoking Emacs with variable-pitch fonts > > as the default will not be able to take advantage of this improvement, > > which basically makes all this change useless. > > If I'm not mistaken, the font*_open functions take a single frame > argument F, and the average width property doesn't need to be computed > until then. Can't you obtain the DC from that frame? That's what I tried. The problem is, first time we open the fonts (which is when it's important to have the metrics of the default face's font), we are called from x-create-frame for the initial frame, and the frame's w32-specific attributes are not yet set. The window-system for the frame is still "initial", and get_frame_dc aborts.