From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: KOBAYASHI Yasuhiro Newsgroups: gmane.emacs.devel Subject: Emacs-unicode-2: w32_font_match Date: Tue, 02 Nov 2004 15:09:58 +0900 Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1099375749 18123 80.91.229.6 (2 Nov 2004 06:09:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 Nov 2004 06:09:09 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 02 07:09:00 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1COrqm-000338-00 for ; Tue, 02 Nov 2004 07:09:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1COryn-0004gl-TC for ged-emacs-devel@m.gmane.org; Tue, 02 Nov 2004 01:17:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1COryh-0004gg-3r for emacs-devel@gnu.org; Tue, 02 Nov 2004 01:17:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1COryg-0004gU-MO for emacs-devel@gnu.org; Tue, 02 Nov 2004 01:17:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1COryg-0004gR-Jz for emacs-devel@gnu.org; Tue, 02 Nov 2004 01:17:10 -0500 Original-Received: from [210.157.254.238] (helo=mail.otsukakj.co.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1COrqP-0005Ka-Fa; Tue, 02 Nov 2004 01:08:38 -0500 Original-Received: from NSZ124 (localhost [127.0.0.1]) by mail.otsukakj.co.jp (8.12.10/8.12.10) with ESMTP id iA268U1j023800; Tue, 2 Nov 2004 15:08:31 +0900 (JST) Original-To: Jason Rumney , Kenichi Handa X-Face: sx{*Zd5t@lP<&#~%3p=Z'z@ru$R6Bvwu3`mD?-!>[pr@Do`[`tu-$[0\OB6%gb:z/7 iuq3LblNTXV@AU\/w=hI[\w}\Hr1UM~>x\cQtaXq&w:LcZn/yvAOIHk"^$laja@tc|:Y"DC]/F!W"D "*_Y$vOKK5 X-PGP-DSS: BE16 34D8 BC0B 52B5 0E86 9D4B 9B89 77B3 1D8D A872 X-PGP-Key: http://homepage3.nifty.com/y3tk/gpg/pubkey.asc User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (i386-mingw-nt5.1.2600) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:29288 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29288 --=-=-= Content-Type: text/plain; charset=shift_jis Content-Transfer-Encoding: quoted-printable It seems that w32_font_match() dose't work correctly in the case of using font name with multibyte in emacs-unicode-2. The variable 'encoded_font_name' may include the charactor '-', then 'xlfd_strip_height (font_name_copy)' return -1, so I think that string_make_unibyte should not be used. For example: (create-fontset-from-fontset-spec "-*-Courier New-normal-r-*-*-12-*-*-*-c-*-fontset-TTG12c, japanese-jisx0208:-*-=82l=82r =83S=83V=83b=83N-*-*-*-*-*-*-*-*-*-*-jisx020= 8-sjis, latin-jisx0201:-*-=82l=82r =83S=83V=83b=83N-*-*-*-*-*-*-*-*-*-*-jisx0208-s= jis, katakana-jisx0201:-*-=82l=82r =83S=83V=83b=83N-*-*-*-*-*-*-*-*-*-*-jisx020= 8-sjis" t) (gdb) b w32_font_match Breakpoint 4, w32_font_match (fontname=3D0x83e020 "-outline-?=AD?=B3 =E3\20= 2=B4=E3\202=B7=E3\203\203=E3\202=AF-normal-r-normal-normal-12-90-96-96-c-*-= jisx0208-sjis", pattern=3D0x2dcc9b0 "-outline-hgp=E5\211=B5=E8\213=B1=E8=A7= \222?=BA?\236?=BC?=AF?=B8ub-normal-r-normal-normal-12-*-96-96-p-*-jisx0208-= sjis") at w32fns.c:5809 (gdb) p encoded_font_name=20 $3 =3D 35884144 (gdb) xstring=20 $4 =3D (struct Lisp_String *) 0x2238c70 "-outline--3 =B4=B7=C3=AF-normal-r-normal-normal-12-90-96-96-c-*-jisx0208-s= jis" The attached patch use fast_string_match for comparing font names, just like 2004-10-18 Kenichi Handa * fontset.c (fs_load_font): Use fast_string_match_ignore_case for comparing font names. (fs_query_fontset): Use fast_string_match for comparing fontset names. (list_fontsets): Likewise. * search.c (fast_string_match_ignore_case): New function. * lisp.h (fast_string_match_ignore_case): Extern it. --=20 KOBAYASHI Yasuhiro --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=w32fns.c.diff Content-Description: w32fns.c Index: src/w32fns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/w32fns.c,v retrieving revision 1.219.2.11 diff -u -r1.219.2.11 w32fns.c --- src/w32fns.c 22 Oct 2004 10:13:34 -0000 1.219.2.11 +++ src/w32fns.c 1 Nov 2004 15:41:37 -0000 @@ -5667,14 +5667,12 @@ char * fontname; char * pattern; { - char *font_name_copy; - char *ptr; - Lisp_Object encoded_font_name; char *regex = alloca (strlen (pattern) * 2 + 3); + char *font_name_copy = alloca (strlen (fontname) + 1); + char *ptr; - /* Convert fontname to unibyte for match. */ - encoded_font_name = string_make_unibyte (build_string (fontname)); - font_name_copy = SDATA (encoded_font_name); + /* Copy fontname so we can modify it during comparison. */ + strcpy (font_name_copy, fontname); ptr = regex; *ptr++ = '^'; @@ -5712,8 +5710,8 @@ return FALSE; } - return (fast_c_string_match_ignore_case (build_string (regex), - font_name_copy) >= 0); + return (fast_string_match_ignore_case (build_string (regex), + build_string (fontname)) >= 0); } /* Callback functions, and a structure holding info they need, for --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--