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: Fri, 08 Sep 2023 21:42:37 +0800 Message-ID: <87wmx0dbn6.fsf@yahoo.com> References: <83bkeeytwf.fsf@gnu.org> <838r9iyrky.fsf@gnu.org> <835y4myqtb.fsf@gnu.org> <83jzt1xju6.fsf@gnu.org> <83wmx0x3hj.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="17783"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65803@debbugs.gnu.org, Shingo Tanaka To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 08 15:44:22 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 1qebmX-0004RN-Ra for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 08 Sep 2023 15:44:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qebmE-0001Su-8Y; Fri, 08 Sep 2023 09:44: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 1qebmD-0001SW-6A for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 09:44:01 -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 1qebmC-0007Vh-Ud for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 09:44:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qebmE-0007xZ-Gt for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 09:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Sep 2023 13:44: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.169418058430521 (code B ref 65803); Fri, 08 Sep 2023 13:44:02 +0000 Original-Received: (at 65803) by debbugs.gnu.org; 8 Sep 2023 13:43:04 +0000 Original-Received: from localhost ([127.0.0.1]:42615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeblI-0007wD-8r for submit@debbugs.gnu.org; Fri, 08 Sep 2023 09:43:04 -0400 Original-Received: from sonic312-23.consmr.mail.ne1.yahoo.com ([66.163.191.204]:45780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeblD-0007vh-U5 for 65803@debbugs.gnu.org; Fri, 08 Sep 2023 09:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694180572; bh=h6rKeqqXQyNcKltTj1Y8zAz89/mzVmOxuRMl4jClgec=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=B/U8rG+P4YglYgIdbxTySNUozsWwPofktnA7T6glT2y14ds8QdFyYJp681MLbBsMRJA6MLNd0LClmzN0aQIgp/O238OQRkMlAIPU+bmH50jyurcEP8W4Dij0ar3T6wQGJX7pcQ94NoBAO5AcYlpcx1Z2oNTIMSqWDHtrfC8teD2/6qNClTsatHc8SPXXh+DZQ7dSz9fbbKNc+El3fyOED4TDarBGk1umtYFV+86LGsZXH3Mc6Kkv88Urx3Td0HolTgf4LM+4cU/IsAXkli5nISYed8a8SsrxD0wJQN+vnx7I90oNhLeJNdVsM//myhx+R4c7LCSJht/SUw1ztVFrdg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694180572; bh=015aOJ2jx4YKnpLKFSGFQNOLuZ7P4Vm4c4/Ohx5HIqI=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=LhONW/khA1VkWWH2PfqAVbmHuoK9vpUvJKVwkQu8SH4JE3Edq1ohNqwJnX25DIkH48TVsY7juQa+//6ozK62TDGnuT2IhUsIKfcfA1enQaiadd5OnRvVwyYvZog4X6e9AoAQTCcoo3+L2aNh0XdoAj29zu+nkgcqXrKtoa7SxaGRc+94+kRE4of6hnukR5NKT1GSbZNEbsvK+nom146jOCMLbmxzvznxQAMAF1S40uUAMa+3dzV4LJxR3wm3ahR+cOoDY+2iGKbZtrsVUGiVC0BHGGMgNa8H1hYoESvsfP85A5pMOGaxn0gFksCwgUzjf2sIzRapXvR3L91w2XJrgg== X-YMail-OSG: 5Vjfh1cVM1kDMCHmvgoxePcsK9V5e.E7DkMTuc2gR9TQLGxPspRhTTYgYor.is0 _dHYuYTbm5yl_KSONjqXAKSjVRL3QPayeifNmchrWu9ed_BRD941WQ92C.Qldve2qCGLeysmFF88 VWVjcfNDFh3rTSzlnihG5KsWAbDkPsgv4vAlbKhmN_kza79L0DSbEfNjosx0jJn_nzEC3jj_qtLY oUJetcndiUo9MHDUHdV9p19ZkUVBTwkxAatjt5IXo7KqwuCSlKxxOKmSeqW5NKrT3cZ.C9X8ThK5 nT_TwGGCPbVFEwIrrt9MADt.nCk5lUx_ppiyPl.vWiTUgg0yvmT353WEmrT0NCkIdRzcuu2J.zOa sv76xOdzEONSBjh2.sKizXQPjO0hPfEhMkLQFjhY9KoBPlYsJN_Y4aVntYe8nvgE1R5z9.anAmgj tM514lbgPyeMei9ta17cLoF38vTmX1_ZvRwHaFSaxSVD8rdqqz6Qkh_0KEM1yfVZmaPOEqU7uTmn vEZPuCVMpVaXZt6RJeGdtQQgKeAmOskXapEfO9E9K0h1qak0YM70p_LKPyyNMz8n4gN7lUc1mcoW iJJpApjt2laRusc62SFC9m6sewADdNQkbFblgWeoc9FsOKTfc8mI1zWmXOXvXs8.6GIeM4qgFxu_ SgCSr9iwKgreqqOAVacumD_JptqZFw_Wo.p.BBm66T2pWMW2lq1r0gm30xQ1BK6_1aVkmN5N7rv_ d4PZP9Pv_l8X7UJ6JTUgtj13u2yArsv6rHhLlKX1Dt3t6fN_PZgM7jyjt_e2QkCLrHB8R4uq65Mc _jZNJTvqESTZbdMy6KmlLIwpf4xP2P.DHx07vFGXXS X-Sonic-MF: X-Sonic-ID: b0a866b0-2a42-4781-a707-8401220e521a Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Fri, 8 Sep 2023 13:42:52 +0000 Original-Received: by hermes--production-sg3-69654d8bd-52vxq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 6743302ef75b376dbdc1404e305bbd63; Fri, 08 Sep 2023 13:42:45 +0000 (UTC) In-Reply-To: <83wmx0x3hj.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Sep 2023 15:18:32 +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:269777 Archived-At: Eli Zaretskii writes: > This is strange. AFAIU, frame-char-width returns the "average width" > attribute of the font, so why do we get different results on Windows > and on X? Po Lu, can you help? Do font backends on X perform some > trickery on the font's average_width attribute that we don't do on > Windows? For a nominally monospace font, the ft*font backends infer the average from the width of the space glyph, instead of giving undue credence to its reported ``average width''. CJK fonts customarily contain tens of thousands of glyphs, of which only a small subset represent ASCII ``monospace'' characters relevant to Emacs, but the `tmAveCharWidth' field, which is derived from the font's OS/2 table: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html represents the average width of all the glyphs within the font, and is ergo naturally biased towards the large number of CJK glyphs incorporated within the font. The W32 backend should either infer the average width itself, or ground it upon on the width of the space glyph. Refer to this code in ftfont_open: 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;