From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kazuhiro Ito Newsgroups: gmane.emacs.bugs Subject: bug#12693: [cygwin] Setting fonts with non-ascii names throws error quit Date: Mon, 14 Sep 2020 20:38:31 +0900 Message-ID: <864ko0si4o.wl--xmue@d1.dion.ne.jp> References: <87y5j0ddgj.wl%%xmue@d1.dion.ne.jp> <871rj5k5xp.fsf@gnus.org> <867dswsqdp.wl--xmue@d1.dion.ne.jp> <87o8m8d40z.fsf@gnus.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-2022-JP Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6108"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 Emacs/28.0.50 (x86_64-w64-mingw32) MULE/6.0 (HANACHIRUSATO) Cc: 12693@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 14 13:39:12 2020 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 1kHmpD-0001RI-Qv for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Sep 2020 13:39:11 +0200 Original-Received: from localhost ([::1]:52822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHmpC-0000ch-Rh for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Sep 2020 07:39:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHmp4-0000ae-VE for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2020 07:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kHmp4-0001fR-Lg for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2020 07:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kHmp4-0002JV-I6 for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2020 07:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kazuhiro Ito Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Sep 2020 11:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12693 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 12693-submit@debbugs.gnu.org id=B12693.16000835218854 (code B ref 12693); Mon, 14 Sep 2020 11:39:02 +0000 Original-Received: (at 12693) by debbugs.gnu.org; 14 Sep 2020 11:38:41 +0000 Original-Received: from localhost ([127.0.0.1]:52920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHmoj-0002Ik-8j for submit@debbugs.gnu.org; Mon, 14 Sep 2020 07:38:41 -0400 Original-Received: from snd00005.auone-net.jp ([111.86.247.5]:32640 helo=dmta0009.auone-net.jp) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHmoe-0002IU-1U for 12693@debbugs.gnu.org; Mon, 14 Sep 2020 07:38:39 -0400 Original-Received: from kzhr.d1.dion.ne.jp by dmta0009.auone-net.jp with ESMTP id <20200914113833346.EIQA.46504.kzhr.d1.dion.ne.jp@dmta0009.auone-net.jp>; Mon, 14 Sep 2020 20:38:33 +0900 In-Reply-To: <87o8m8d40z.fsf@gnus.org> 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" Xref: news.gmane.io gmane.emacs.bugs:188037 Archived-At: > > (set-frame-font "MS ゴシック-14") raises an error on Cygw32 build > > but not on MinGW64 build. x-select-font function returns encoded > > string on Cygw32 build. Let-binding locale-coding-system to the > > correct codepage can avoid the problem. > > > > ;; Chose "MS ゴシック-14" > > (x-select-font) > > > > -> "\202l\202r \203S\203V\203b\203N-14" > > Hm... I don't use Windows, so I can't test this, but perhaps the result > from `x-select-font' should use `detect-coding-string' or something on > the result (and then decode it) so that we get a correct string in Emacs? As discussed in the original thread, Emacs uses ANSI version of Windows API to handle fonts. Strings passed to or received from APIs should be encoded in or decoded from ANSI codepage. To do that, ENCODE_SYSTEM and DECODE_SYSTEM macros are used (See src/w32font.c). It means that locale-coding-system is used around Windows font API. That works well on MinGW64, because locale-coding-system is the same with ANSI codepage. But on Cygw32, locale-coding-system is normally utf-8 and it is not ANSI codepage. This is the cause of the problem. My original post makes Emacs use ANSI codepage for Windows font API. Further discussion indicates to make Emacs on Windows use unicode API if available. But no progresss after that. -- Kazuhiro Ito