From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65803: 29.1; Noto Sans Mono CJK JP has doubled-width on Windows Date: Sun, 10 Sep 2023 15:31:36 +0800 Message-ID: <8734zmbi1z.fsf@yahoo.com> 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> <83y1heseud.fsf@gnu.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24311"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65803@debbugs.gnu.org, shingo.fg8@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 10 09:33:10 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 1qfEwP-00066q-Ea for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Sep 2023 09:33:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfEwI-0000QC-Dx; Sun, 10 Sep 2023 03:33:02 -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 1qfEwF-0000OI-PS for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 03:33: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 1qfEwE-0008GH-Hb for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 03:32:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfEwH-0003zw-Q9 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 03:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Sep 2023 07:33:01 +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.169433112415302 (code B ref 65803); Sun, 10 Sep 2023 07:33:01 +0000 Original-Received: (at 65803) by debbugs.gnu.org; 10 Sep 2023 07:32:04 +0000 Original-Received: from localhost ([127.0.0.1]:48891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfEvL-0003yj-UI for submit@debbugs.gnu.org; Sun, 10 Sep 2023 03:32:04 -0400 Original-Received: from sonic303-20.consmr.mail.ne1.yahoo.com ([66.163.188.146]:35381) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfEvE-0003xr-4e for 65803@debbugs.gnu.org; Sun, 10 Sep 2023 03:32:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694331107; bh=1BKrmHagp8aqmAO2o07mqpaqWxLInMTFxI2HY9WYwwE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=kb7Ajl6H/2nkuWh1GZ0L/ouMTR+/q0vI91Ju+3qtAmdHr998Oo5xfJsqas+syEfNPcVmN9Vbt0Fnj1hs+Of+n86GQZhZeIOpn3sQJkM7iS+E+RqOAmzjFYeHmtOikLOfAJZRxs0DtWw7sxtWxLRk4yCisQ74qKoQu/cXR6Ce8JFHzrYuSiyRrGwqO9IMfOEuU2t+Jj8/P7r4ynmwLAsnBoTGyfE4PCmSsI/GmGvNvDBhRqX5geSq/cS0vMu4Xfo0cMKeJH4uo9Ys7oOkqHNMGwq+2O4jhS1ppYX571TOYXYUvS3by3IGb5aSarWD9M2qJEyNoPMJuc5VKswavDIMug== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694331107; bh=lYimh7YE4AHVx24wiZD6dLRseD8z+WIAcxzsRO/mXLp=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=ddCsH2pbOlCYLCuCXjQgsCt+y9BFea1AUG5PmbcbydotKVsVfMyOqLHdYj9RHlry8XGNIcyLkp+BcXLp9okPPwrx8LbObalNsE64IjtyH3c6I74I01xeEar1QxjqwoWLyubu8sNZj9GZ23o4JS/E0KEnnLpbgnaxUSndSqWe6NKZb7sOtvOdY8tzu5bMEKWvB2BXED4SR5BYoE8WwN+57hGCF28tFNlqCCZRUZkJapS5DaRLN2SrqQHTNHUPLStYYHnHbfKnRMNEXcBfC2B5LCtfCKfm9zAsKJ5R9RDfH65JS80nlBoSuPIRtlvczL9Sc+yTan0G+rg+1djrz1deRA== X-YMail-OSG: 8EGLfdUVM1mIJ8_pFvnqeEg3NUP_Vssxkdzq_XeKPiyfB0her7Ig22HASkUat6z ufk8GV6pgw0miq7Ta7Em44grYRUzHKIKwhfbUkXoMxuMfuplOuPJVc95UUNqcQPiYQ6FKxqmnmVk T10dul_lbVkD8brpVzd5D2LyHdjt91iypqLyKnhQzu.xSeg2YUDAiucZUmRAbPfbv5.PW5tgWUrL XSyDwxQUw5dx..ZLhFRkQ5kTZrzC7xQ_Yz06_kK2JSyePlmkxDw8YuHU3BNEsJyLRx4NdWgDRDAh LUsD6rGTUQxnkQO12KJcv0wdmIw7FDFnMIINz3L..tQbwd6u9ohygKBprUGZH8YEGEQ6QxQiMm3x 9zvzGsnGnk30LGlkCcSrZEOOcwqcy6JERNc1Q.Uf70anZJtq2zDjrOBkTvdpu5T.sABReo8nuPrr wtiwCg88nYJy.RwQCVzufORLERmiXKKfIGyh2RpLWOTBqDErI4Khq5Jrbrs_.3HDdhdud6GnlV2F 5x5JEcliNOSG.kJV9pdirRQjm4xJZdjTee6p52YPxtZ_6Pyk0cfZX2iwdORJx6ca6DTnV0zIyKv2 1exR8fOmeC0Nyw7i2Ze4WIM18opzgLLPrHKmL.xoaH0Ezt7Mq8m4r9xT0s_.9AUS3fsw.czKxOGT OsDzFKY7T6EUrYszq3mwdYjcXhntNRLGXb8ttj37pYuVUWWTKoWRuzKWh8DCnsr_eWMpv.ABasEH xlnstAhlmwZU.HWW9aBWn1QfMbPqF7oqDVJubA6op6w0vVamiSBHg6HVuwnl89gKI.Ff6hktONyu .xDyqzttr1ba02fWhOO3lnvejHOvX0y7bwtDpUSbrI X-Sonic-MF: X-Sonic-ID: bb663c0b-e278-4124-95f2-177c0af01ade Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Sun, 10 Sep 2023 07:31:47 +0000 Original-Received: by hermes--production-sg3-69654d8bd-752gm (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 89169605074caaad5b4acef0564a4bb7; Sun, 10 Sep 2023 07:31:41 +0000 (UTC) In-Reply-To: <83y1heseud.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 10 Sep 2023 09:48:58 +0300") X-Mailer: WebService/1.1.21763 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:269921 Archived-At: Eli Zaretskii writes: >> 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. Because if spacing is not FC_PROPORTIONAL or FC_DUAL, we know in advance that max_advance_width or max_advance are identical to the average of all ASCII glyphs. Such special treatment is an optimization, nothing more. max_advance_width is the advance width (in em space) of the widest glyph when the font is scalable, and max_advance is that in pixel space if not.