From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: set-fontset-font and preferred charset? Date: Wed, 08 Jul 2009 20:29:38 +0900 Message-ID: References: <20090703.082403.252821682.wl@gnu.org> <20090703.180535.61736917731643487.kasahara@nc.kyushu-u.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1247052611 13049 80.91.229.12 (8 Jul 2009 11:30:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jul 2009 11:30:11 +0000 (UTC) Cc: kasahara@nc.kyushu-u.ac.jp, emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 08 13:30:04 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MOVLf-0005dd-5t for ged-emacs-devel@m.gmane.org; Wed, 08 Jul 2009 13:30:03 +0200 Original-Received: from localhost ([127.0.0.1]:48707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOVLe-0007Br-6g for ged-emacs-devel@m.gmane.org; Wed, 08 Jul 2009 07:30:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOVLP-00074O-Em for emacs-devel@gnu.org; Wed, 08 Jul 2009 07:29:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOVLL-00072P-Vq for emacs-devel@gnu.org; Wed, 08 Jul 2009 07:29:47 -0400 Original-Received: from [199.232.76.173] (port=34139 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOVLL-00072L-J2 for emacs-devel@gnu.org; Wed, 08 Jul 2009 07:29:43 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]:56817) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MOVLK-0006vH-Ng for emacs-devel@gnu.org; Wed, 08 Jul 2009 07:29:43 -0400 Original-Received: from rqsmtp1.aist.go.jp (rqsmtp1.aist.go.jp [150.29.254.115]) by mx1.aist.go.jp with ESMTP id n68BTdLT012620; Wed, 8 Jul 2009 20:29:39 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp1.aist.go.jp by rqsmtp1.aist.go.jp with ESMTP id n68BTdkC011878; Wed, 8 Jul 2009 20:29:39 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp1.aist.go.jp with ESMTP id n68BTcw5024273; Wed, 8 Jul 2009 20:29:39 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken with local (Exim 4.69) (envelope-from ) id 1MOVLG-00030b-Oi; Wed, 08 Jul 2009 20:29:38 +0900 In-Reply-To: (message from YAMAMOTO Mitsuharu on Wed, 08 Jul 2009 17:48:34 +0900) X-detected-operating-system: by monty-python.gnu.org: Solaris 9 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: news.gmane.org gmane.emacs.devel:112170 Archived-At: In article , YAMAMOTO Mitsuharu writes: >>>>>> On Wed, 08 Jul 2009 17:09:35 +0900, YAMAMOTO Mitsuharu said: >>>>>> On Wed, 08 Jul 2009 16:44:50 +0900, Kenichi Handa said: >>>> 3. When I open "HELLO" file, some (not all) Japanese characters in >>>> other buffers start to be rendered using xft backend. When I open >>>> another X frame, the font suddenly change to X font (both old and >>>> new frames). >>> There was a silly bug in handling a preferred charset in >>> fontset_find_font. I've installed a fix for the trunk. > > Could you try compiling it with -DENABLE_CHECKING? I got > > .../src/fontset.c:618: Emacs fatal error: assertion failed: > > VECTORLIKEP((rfont_def)) > > with the current trunk code when I tried C-h h. It doesn't happen > > with the EMACS_23_1_RC branch. I can't reproduce that bug but perhaps that is because we have different font setting. > When the assertion failure happened, found_index == -1, > charset_matched == -1, and i == 0. The negative found_index is > problematic because it is used as an index for AREF. I think I found what is wrong. Could you please try this patch? --- Kenichi Handa handa@m17n.org --- fontset.c.~1.177.~ 2009-07-07 20:27:15.000000000 +0900 +++ fontset.c 2009-07-08 20:26:45.000000000 +0900 @@ -575,25 +575,25 @@ Lisp_Object font_def; Lisp_Object font_entity, font_object; + found_index = i; if (i == 0) { - /* Try the element matching with the charset ID at first. */ - found_index = charset_matched; if (charset_matched > 0) { + /* Try the element matching with the charset ID at first. */ + found_index = charset_matched; + /* Make this negative so that we don't come here in the + next loop. */ charset_matched = - charset_matched; + /* We must try the first element in the next loop. */ i--; } } - else if (i != - charset_matched) - { - found_index = i; - } - else + else if (i == - charset_matched) { /* We have already tried this element and the followings - that have the same font specifications. So, skip them - all. */ + that have the same font specifications in the first + iteration. So, skip them all. */ rfont_def = AREF (vec, i); font_def = RFONT_DEF_FONT_DEF (rfont_def); for (; i + 1 < ASIZE (vec); i++) @@ -610,7 +610,7 @@ rfont_def = AREF (vec, found_index); if (NILP (rfont_def)) { - if (charset_matched < 0) + if (i < 0) continue; /* This is a sign of not to try the other fonts. */ return Qt;