From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kazuhiro Ito Newsgroups: gmane.emacs.bugs Subject: bug#12693: 24.2.50; src/w32font.c should depend on ANSI code page Date: Sun, 21 Oct 2012 06:46:04 +0900 Message-ID: <87y5j0ddgj.wl%%xmue@d1.dion.ne.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-2022-JP X-Trace: ger.gmane.org 1350769648 32362 80.91.229.3 (20 Oct 2012 21:47:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Oct 2012 21:47:28 +0000 (UTC) To: 12693@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 20 23:47:36 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TPgtL-0007f0-HX for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Oct 2012 23:47:35 +0200 Original-Received: from localhost ([::1]:47755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPgtE-0004Af-7g for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Oct 2012 17:47:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPgtC-0004AZ-3Y for bug-gnu-emacs@gnu.org; Sat, 20 Oct 2012 17:47:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPgtB-0002qc-6j for bug-gnu-emacs@gnu.org; Sat, 20 Oct 2012 17:47:26 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPgtB-0002qW-3B for bug-gnu-emacs@gnu.org; Sat, 20 Oct 2012 17:47:25 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TPguk-000593-3U for bug-gnu-emacs@gnu.org; Sat, 20 Oct 2012 17:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kazuhiro Ito Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Oct 2012 21:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12693 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135076968919711 (code B ref -1); Sat, 20 Oct 2012 21:49:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Oct 2012 21:48:09 +0000 Original-Received: from localhost ([127.0.0.1]:53525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPgtt-00057s-3j for submit@debbugs.gnu.org; Sat, 20 Oct 2012 17:48:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51038) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPgtp-00057O-QI for submit@debbugs.gnu.org; Sat, 20 Oct 2012 17:48:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPgsA-0002jJ-Ag for submit@debbugs.gnu.org; Sat, 20 Oct 2012 17:46:23 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:57331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPgsA-0002jF-7L for submit@debbugs.gnu.org; Sat, 20 Oct 2012 17:46:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPgs9-00048K-5Z for bug-gnu-emacs@gnu.org; Sat, 20 Oct 2012 17:46:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPgs8-0002iv-0S for bug-gnu-emacs@gnu.org; Sat, 20 Oct 2012 17:46:21 -0400 Original-Received: from msa105.auone-net.jp ([61.117.18.165]:39734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPgs7-0002iY-GQ for bug-gnu-emacs@gnu.org; Sat, 20 Oct 2012 17:46:19 -0400 Original-Received: from GUNGNIR.med.osaka-cu.ac.jp (112-68-160-32f1.nar1.eonet.ne.jp [112.68.160.32]) by msa105.auone-net.jp (au one net msa) with ESMTP id 573962C803A; Sun, 21 Oct 2012 06:46:12 +0900 (JST) User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL/10.8 EasyPG/1.0.0 Emacs/24.2.50 (i386-mingw-nt6.1.7601) MULE/6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65799 Archived-At: When I run Emacs on Cygwin with the native Windows UI, I can't specify font by non-ascii font name. For example, the below code success on precompiled binary on Windows (Japanese edition) but raises error on Cygwin with the native Windows UI. (set-default-font "MS ゴシック-14") The reason is that lfFaceName member of LOGFONT structure is expected to be encoded in ANSI code page, but Emacs encodes in or decodes as the coding system specified in locale-coding-system variable. It is set to utf-8-unix on Cygwin and causes the above problem. I think the below patch or similar modification would be needed. === modified file 'src/w32font.c' --- src/w32font.c 2012-09-17 12:07:36 +0000 +++ src/w32font.c 2012-10-20 12:12:49 +0000 @@ -34,6 +34,15 @@ #include "font.h" #include "w32font.h" +/* From w32select.c */ +extern Lisp_Object QANSICP; + +#define ENCODE_ACP(str) \ + (code_convert_string_norecord (str, QANSICP, 1)) + +#define DECODE_ACP(str) \ + (code_convert_string_norecord (str, QANSICP, 0)) + /* Cleartype available on Windows XP, cleartype_natural from XP SP1. The latter does not try to fit cleartype smoothed fonts into the same bounding box as the non-antialiased version of the font. @@ -285,7 +294,7 @@ Lisp_Object intern_font_name (char * string) { - Lisp_Object str = DECODE_SYSTEM (build_string (string)); + Lisp_Object str = DECODE_ACP (build_string (string)); int len = SCHARS (str); Lisp_Object obarray = check_obarray (Vobarray); Lisp_Object tem = oblookup (obarray, SDATA (str), len, len); @@ -971,10 +980,10 @@ } if (name) font->props[FONT_FULLNAME_INDEX] - = DECODE_SYSTEM (build_string (name)); + = DECODE_ACP (build_string (name)); else font->props[FONT_FULLNAME_INDEX] - = DECODE_SYSTEM (build_string (logfont.lfFaceName)); + = DECODE_ACP (build_string (logfont.lfFaceName)); } font->max_width = w32_font->metrics.tmMaxCharWidth; @@ -2035,7 +2044,7 @@ else if (SYMBOLP (tmp)) { strncpy (logfont->lfFaceName, - SDATA (ENCODE_SYSTEM (SYMBOL_NAME (tmp))), LF_FACESIZE); + SDATA (ENCODE_ACP (SYMBOL_NAME (tmp))), LF_FACESIZE); logfont->lfFaceName[LF_FACESIZE-1] = '\0'; } } @@ -2131,7 +2140,7 @@ if (NILP (family)) continue; else if (SYMBOLP (family)) - name = SDATA (ENCODE_SYSTEM (SYMBOL_NAME (family))); + name = SDATA (ENCODE_ACP (SYMBOL_NAME (family))); else continue; @@ -2511,7 +2520,7 @@ || logfont_to_fcname (&lf, cf.iPointSize, buf, 100) < 0) return Qnil; - return DECODE_SYSTEM (build_string (buf)); + return DECODE_ACP (build_string (buf)); } static const char *const w32font_booleans [] = { === modified file 'src/w32select.c' --- src/w32select.c 2012-10-11 00:32:25 +0000 +++ src/w32select.c 2012-10-20 06:11:00 +0000 @@ -117,7 +117,8 @@ based on current system parameters. */ static LCID DEFAULT_LCID; static UINT ANSICP, OEMCP; -static Lisp_Object QUNICODE, QANSICP, QOEMCP; +static Lisp_Object QUNICODE, QOEMCP; +Lisp_Object QANSICP; /* A hidden window just for the clipboard management. */ static HWND clipboard_owner; -- Kazuhiro Ito