emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set-fontset-font and preferred charset?


From: Kenichi Handa
Subject: Re: set-fontset-font and preferred charset?
Date: Wed, 08 Jul 2009 20:29:38 +0900

In article <address@hidden>, YAMAMOTO Mitsuharu <address@hidden> writes:

>>>>>> On Wed, 08 Jul 2009 17:09:35 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>>> said:
>>>>>> On Wed, 08 Jul 2009 16:44:50 +0900, Kenichi Handa <address@hidden> 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
address@hidden


--- 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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]