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 09:48:58 +0300 Message-ID: <83y1heseud.fsf@gnu.org> References: <83bkeeytwf.fsf@gnu.org> <838r9iyrky.fsf@gnu.org> <835y4myqtb.fsf@gnu.org> <83jzt1xju6.fsf@gnu.org> <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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28001"; 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 08:50:24 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 1qfEH1-00074p-So for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Sep 2023 08:50:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfEGk-0000CY-32; Sun, 10 Sep 2023 02:50:06 -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 1qfEGe-0000CA-41 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 02:50: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 1qfEGc-00082c-TN for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 02:49:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfEGg-0002yd-5O for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 02:50: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 06:50: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.169432857611406 (code B ref 65803); Sun, 10 Sep 2023 06:50:02 +0000 Original-Received: (at 65803) by debbugs.gnu.org; 10 Sep 2023 06:49:36 +0000 Original-Received: from localhost ([127.0.0.1]:48860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfEGG-0002xt-3E for submit@debbugs.gnu.org; Sun, 10 Sep 2023 02:49:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfEGD-0002xh-OO for 65803@debbugs.gnu.org; Sun, 10 Sep 2023 02:49:34 -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 1qfEG5-0007zJ-30; Sun, 10 Sep 2023 02:49:25 -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=S+NwtfhUvBjIV6G4RZ7j5WasTAyWWMOdMlC+BTtScwI=; b=j1Gl/NyPs0wv Ytyx7bOLxJhLLipgtWyTOaX+Dj+QdpROICkot0rO2lKOzFdXsSTkFuwQMnyLrKH8Sj7hrtxpl7qd3 jy3xA6RPrwgKUSTXrWtP7uu4v5UaP1id0c/ABb536lQyajj312C9ar/N2bLJkSkzD+o8s1e6EZPnw 9eOeeuudmQkmYxHP3QFb49tpOA0FLy79AMaQAFVqt+SZGGpt6ymCGSl+8VnV5XIfuMJjVqdZXatRu H5WvvGZTBPGe6k99kt0eeEY3acP54jQLNqIr4m6eQyPOwkPX0rvNM4Pt0E+xrxP+mNStvzT+n1zRl bc8ZsctzJ6HoHk19du4K3w==; In-Reply-To: <877coybmho.fsf@yahoo.com> (message from Po Lu on Sun, 10 Sep 2023 13:55:47 +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:269918 Archived-At: > From: Po Lu > Cc: shingo.fg8@gmail.com, 65803@debbugs.gnu.org > Date: Sun, 10 Sep 2023 13:55:47 +0800 > > Eli Zaretskii writes: > > > No, the purpose of FRAME_COLUMN_WIDTH is much more than just "the > > width of ASCII characters". It is used as the canonical character > > width of the frame, for gazillion purposes. One example which > > triggered this bug is :align-to display spec, something utterly > > unrelated to ASCII characters. > > However, the column width has hitherto been defined to the average width > of the frame font's ASCII characters. At least outside W32, that is. No! Once again, for fixed-pitch fonts the average width is taken from the font. Here, from ftfont.c: if (spacing != FC_PROPORTIONAL #ifdef FC_DUAL && spacing != FC_DUAL #endif /* FC_DUAL */ ) font->min_width = font->average_width = font->space_width = (scalable ? ft_face->max_advance_width * size / upEM + 0.5 : ft_face->size->metrics.max_advance >> 6); else { int n; font->min_width = font->average_width = font->space_width = 0; for (i = 32, n = 0; i < 127; i++) if (FT_Load_Char (ft_face, i, FT_LOAD_DEFAULT) == 0) { int this_width = ft_face->glyph->metrics.horiAdvance >> 6; if (this_width > 0 && (! font->min_width || font->min_width > this_width)) font->min_width = this_width; if (i == 32) font->space_width = this_width; font->average_width += this_width; n++; } if (n > 0) font->average_width /= n; } This clearly only calculates the average width for proportional fonts, and otherwise takes the average width from the font's max_advance width without calculating anything. Or what am I missing? > > But other font back-ends don't compute average_width for fixed-pitch > > fonts, so are you only talking about proportional fonts here? > > I'm talking about fonts in general: since fixed pitch fonts are meant to > incorporate uniformly sized glyphs, the width of the space glyph should > represent the average width of any subset of the font's glyphs. In this > particular case, Fontconfig doesn't deem the font in question a fixed > pitch font, and thus Emacs measures the average width of each ASCII > character itself. See above: other backends only calculate the average width for proportional fonts. So what you say doesn't fit my reading of the code.