changeset 89904:76c449b624ad

Sync to HEAD.
author Kenichi Handa <handa@m17n.org>
date Wed, 14 Apr 2004 06:24:18 +0000
parents d529a6280ed6
children 37e044cc35f6
files lisp/international/mule-diag.el src/fontset.c src/fontset.h
diffstat 3 files changed, 59 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-diag.el	Wed Apr 14 06:14:18 2004 +0000
+++ b/lisp/international/mule-diag.el	Wed Apr 14 06:24:18 2004 +0000
@@ -324,7 +324,7 @@
       (insert "Number of contained characters: ")
       (dotimes (i (charset-dimension charset))
 	(unless (= i 0)
-	  (insert ?×))
+	  (insert ?x))
 	(insert (format "%d" (charset-chars charset (1+ i)))))
       (insert ?\n)
       (let ((char (charset-iso-final-char charset)))
@@ -398,7 +398,7 @@
 			 (format "%s:%s, and also used by the following:"
 				 (car charset)
 				 (charset-description (car charset)))
-		       "no initial designation, and used by the followings:"))
+		       "no initial designation, and used by the following:"))
 		    (t
 		     "invalid designation information"))))
       (when (listp charset)
@@ -646,7 +646,7 @@
 		 (setq codings (cons x codings))))
 	   (get (car categories) 'coding-systems))
 	  (if codings
-	      (let ((max-col (frame-width))
+	      (let ((max-col (window-width))
 		    pos)
 		(princ (format "\
   The following are decoded correctly but recognized as %s:\n   "
@@ -784,7 +784,7 @@
 ##  EOL = 0 (LF), 1 (CRLF), 2 (CR), or 3 (Automatic detection)
 ##  FLAGS =
 ##    if TYPE = 2 then
-##      comma (`,') separated data of the followings:
+##      comma (`,') separated data of the following:
 ##        G0, G1, G2, G3, SHORT-FORM, ASCII-EOL, ASCII-CNTL, SEVEN,
 ##        LOCKING-SHIFT, SINGLE-SHIFT, USE-ROMAN, USE-OLDJIS, NO-ISO6429
 ##    else if TYPE = 4 then
@@ -1269,7 +1269,5 @@
 
 (provide 'mule-diag)
 
-;; Local Variables:
-;; coding: utf-8
-;; End:
+;;; arch-tag: cd3b607c-2893-45a0-a4fa-a6535754dbee
 ;;; mule-diag.el ends here
--- a/src/fontset.c	Wed Apr 14 06:14:18 2004 +0000
+++ b/src/fontset.c	Wed Apr 14 06:24:18 2004 +0000
@@ -42,6 +42,15 @@
 #include "intervals.h"
 #include "fontset.h"
 #include "window.h"
+#ifdef HAVE_X_WINDOWS
+#include "xterm.h"
+#endif
+#ifdef WINDOWSNT
+#include "w32term.h"
+#endif
+#ifdef MAC_OS
+#include "macterm.h"
+#endif
 
 #undef xassert
 #ifdef FONTSET_DEBUG
@@ -1698,9 +1707,16 @@
 }
 
 
-/* Return the font name for the character at POSITION in the current
+/* 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.  It returns nil in the following cases:
+   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
+   the font instead of the character at POSITION.
+
+   It returns nil in the following cases:
 
    (1) The window system doesn't have a font for the character (thus
    it is displayed by an empty box).
@@ -1714,10 +1730,10 @@
    POSITION is currently not visible.  */
 
 
-DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 1, 0,
+DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
        doc: /* For internal use only.  */)
-     (position)
-     Lisp_Object position;
+     (position, ch)
+     Lisp_Object position, ch;
 {
   int pos, pos_byte, dummy;
   int face_id;
@@ -1734,7 +1750,13 @@
   if (pos < BEGV || pos >= ZV)
     args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
   pos_byte = CHAR_TO_BYTE (pos);
-  c = FETCH_CHAR (pos_byte);
+  if (NILP (ch))
+    c = FETCH_CHAR (pos_byte);
+  else
+    {
+      CHECK_CHARACTER (ch);
+      c = XINT (ch);
+    }
   window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
   if (NILP (window))
     return Qnil;
@@ -1749,9 +1771,26 @@
     charset_id = -1;
   rfont_def = fontset_font (FONTSET_FROM_ID (face->fontset),
 			    c, face, charset_id);
-  return (VECTORP (rfont_def) && STRINGP (AREF (rfont_def, 3))
-	  ? AREF (rfont_def, 3)
-	  : Qnil);
+  if (VECTORP (rfont_def) && STRINGP (AREF (rfont_def, 3)))
+    {
+      Lisp_Object font_def;
+      struct font_info *fontp;
+      struct charset *charset;
+      XChar2b char2b;
+      int code;
+
+      font_def = AREF (rfont_def, 2);
+      charset = CHARSET_FROM_ID (XINT (AREF (font_def, 1)));
+      code = ENCODE_CHAR (charset, c);
+      if (code == CHARSET_INVALID_CODE (charset))
+	return (Fcons (AREF (rfont_def, 3), Qnil));
+      STORE_XCHAR2B (&char2b, ((code >> 8) & 0xFF), (code & 0xFF));
+      fontp = (*get_font_info_func) (f, XINT (AREF (rfont_def, 1)));
+      rif->encode_char (c, &char2b, fontp, charset, NULL);
+      code = (XCHAR2B_BYTE1 (&char2b) << 8) | XCHAR2B_BYTE2 (&char2b);
+      return (Fcons (AREF (rfont_def, 3), make_number (code)));
+    }
+  return Qnil;
 }
 
 
@@ -2096,3 +2135,6 @@
   defsubr (&Sfontset_list_all);
 #endif
 }
+
+/* arch-tag: ea861585-2f5f-4e5b-9849-d04a9c3a3537
+   (do not change this comment) */
--- a/src/fontset.h	Wed Apr 14 06:14:18 2004 +0000
+++ b/src/fontset.h	Wed Apr 14 06:24:18 2004 +0000
@@ -238,3 +238,6 @@
 extern int fontset_height P_ ((int));
 
 #endif /* EMACS_FONTSET_H */
+
+/* arch-tag: c27cef7b-3cab-488a-8398-7a4daa96bb77
+   (do not change this comment) */