emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: use of jisx0208 in cvs-status


From: Kenichi Handa
Subject: Re: use of jisx0208 in cvs-status
Date: Fri, 23 Apr 2004 11:12:51 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Dave Love <address@hidden> writes:

> You wrote: 
>>  The attached is the relevant change.

> OK, I have it.  It doesn't work because it reduces to

> (x-list-fonts "-*-*-*-*-*-*-*-*-*-*-*-jisx0208.1990"  'default 
> (selected-frame) 1)
>   => nil

> and I don't have anything encoded as jisx0208.1990:

> (x-list-fonts "-*-*-*-*-*-*-*-*-*-*-*-jisx0208*"  'default (selected-frame) 1)
>   => ("-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0")

Ah!  I found what is wrong.

(fontset-font "fontset-default" ?_SOME_JAPANESE_CHAR_)

should return (nil . "jisx0208.1990").  But, as
face-font-registry-alternatives has this value by default:

(("gb2312.1980" "gb2312.80&gb8565.88" "gbk*")
 ("jisx0208.1990" "jisx0208.1983" "jisx0208.1978")
 ("ksc5601.1989" "ksx1001.1992" "ksc5601.1987")
 ("muletibetan-2" "muletibetan-0"))

font founder in xface.c finds jisx0208.1983 font.

But, char-displayable-p doesn't know about that.

It seems that char-displayable-p should use
internal-char-font to get a correct font because it's too
complicated to write a Lisp code simlulating how xface.c
finds a font.  So, I've just installed the attached change.
Does it work for you?

---
Ken'ichi HANDA
address@hidden

2004-04-23  Kenichi Handa  <address@hidden>

        * international/mule-util.el (char-displayable-p): Simplified by
        using internal-char-font.

2004-04-23  Kenichi Handa  <address@hidden>

        * fontset.c (Finternal_char_font): If POSITION is nil, return
        font for displaying CH with the default face.

Index: mule-util.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/mule-util.el,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -c -r1.54 -r1.55
cvs server: conflicting specifications of output style
*** mule-util.el        29 Mar 2004 03:41:39 -0000      1.54
--- mule-util.el        23 Apr 2004 02:08:22 -0000      1.55
***************
*** 373,399 ****
         ;; On a window system, a character is displayable if we have
         ;; a font for that character in the default face of the
         ;; currently selected frame.
!        (let ((fontset (frame-parameter (selected-frame) 'font))
!              font-pattern)
!          (if (query-fontset fontset)
!              (setq font-pattern (fontset-font fontset char)))
!          (or font-pattern
!              (setq font-pattern (fontset-font "fontset-default" char)))
!          (if font-pattern
!              (progn
!                ;; Now FONT-PATTERN is a string or a cons of family
!                ;; field pattern and registry field pattern.
!                (or (stringp font-pattern)
!                    (let ((family (or (car font-pattern) "*"))
!                          (registry (or (cdr font-pattern) "*")))
!                      (or (string-match "-" family)
!                          (setq family (concat "*-" family)))
!                      (or (string-match "-" registry)
!                          (setq registry (concat registry "-*")))
!                      (setq font-pattern
!                            (format "-%s-*-*-*-*-*-*-*-*-*-*-%s"
!                                    family registry))))
!                (x-list-fonts font-pattern 'default (selected-frame) 1)))))
        (t
         (let ((coding (terminal-coding-system)))
           (if coding
--- 373,379 ----
         ;; On a window system, a character is displayable if we have
         ;; a font for that character in the default face of the
         ;; currently selected frame.
!        (car (internal-char-font nil char)))
        (t
         (let ((coding (terminal-coding-system)))
           (if coding

Index: fontset.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fontset.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -c -r1.85 -r1.86
cvs server: conflicting specifications of output style
*** fontset.c   20 Apr 2004 00:22:16 -0000      1.85
--- fontset.c   23 Apr 2004 02:04:13 -0000      1.86
***************
*** 1212,1218 ****
  /* Return a cons (FONT-NAME . GLYPH-CODE).
     FONT-NAME is the font name for the character at POSITION in the current
     buffer.  This is computed from all the text properties and overlays
!    that apply to POSITION.
     GLYPH-CODE is the glyph code in the font to use for the character.
  
     If the 2nd optional arg CH is non-nil, it is a character to check
--- 1212,1221 ----
  /* Return a cons (FONT-NAME . GLYPH-CODE).
     FONT-NAME is the font name for the character at POSITION in the current
     buffer.  This is computed from all the text properties and overlays
!    that apply to POSITION.  POSTION may be nil, in which case,
!    FONT-NAME is the font name for display the character CH with the
!    default face.
! 
     GLYPH-CODE is the glyph code in the font to use for the character.
  
     If the 2nd optional arg CH is non-nil, it is a character to check
***************
*** 1225,1231 ****
  
     (2) The character code is invalid.
  
!    (3) The current buffer is not displayed in any window.
  
     In addition, the returned font name may not take into account of
     such redisplay engine hooks as what used in jit-lock-mode if
--- 1228,1235 ----
  
     (2) The character code is invalid.
  
!    (3) If POSITION is not nil, and the current buffer is not displayed
!    in any window.
  
     In addition, the returned font name may not take into account of
     such redisplay engine hooks as what used in jit-lock-mode if
***************
*** 1240,1270 ****
    int pos, pos_byte, dummy;
    int face_id;
    int c, code;
-   Lisp_Object window;
-   struct window *w;
    struct frame *f;
    struct face *face;
  
!   CHECK_NUMBER_COERCE_MARKER (position);
!   pos = XINT (position);
!   if (pos < BEGV || pos >= ZV)
!     args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
!   pos_byte = CHAR_TO_BYTE (pos);
!   if (NILP (ch))
!     c = FETCH_CHAR (pos_byte);
!   else
      {
        CHECK_NATNUM (ch);
        c = XINT (ch);
      }
    if (! CHAR_VALID_P (c, 0))
      return Qnil;
-   window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
-   if (NILP (window))
-     return Qnil;
-   w = XWINDOW (window);
-   f = XFRAME (w->frame);
-   face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0);
    face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c);
    face = FACE_FROM_ID (f, face_id);
    if (! face->font || ! face->font_name)
--- 1244,1285 ----
    int pos, pos_byte, dummy;
    int face_id;
    int c, code;
    struct frame *f;
    struct face *face;
  
!   if (NILP (position))
      {
        CHECK_NATNUM (ch);
        c = XINT (ch);
+       f = XFRAME (selected_frame);
+       face_id = DEFAULT_FACE_ID;
+     }
+   else
+     {
+       Lisp_Object window;
+       struct window *w;
+ 
+       CHECK_NUMBER_COERCE_MARKER (position);
+       pos = XINT (position);
+       if (pos < BEGV || pos >= ZV)
+       args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
+       pos_byte = CHAR_TO_BYTE (pos);
+       if (NILP (ch))
+       c = FETCH_CHAR (pos_byte);
+       else
+       {
+         CHECK_NATNUM (ch);
+         c = XINT (ch);
+       }
+       window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
+       if (NILP (window))
+       return Qnil;
+       w = XWINDOW (window);
+       f = XFRAME (w->frame);
+       face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 
0);
      }
    if (! CHAR_VALID_P (c, 0))
      return Qnil;
    face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c);
    face = FACE_FROM_ID (f, face_id);
    if (! face->font || ! face->font_name)




reply via email to

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