diff src/fontset.c @ 83112:30dd490f06f2

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-231 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-232 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-233 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-234 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-235 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-236 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-237 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-238 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-239 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-240 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-152
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 23 Apr 2004 14:44:11 +0000
parents d4d5e54871ff 450b41d3c078
children e8df1878cfd1
line wrap: on
line diff
--- a/src/fontset.c	Fri Apr 23 13:56:26 2004 +0000
+++ b/src/fontset.c	Fri Apr 23 14:44:11 2004 +0000
@@ -195,7 +195,7 @@
 static int fontset_id_valid_p P_ ((int));
 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
 static Lisp_Object font_family_registry P_ ((Lisp_Object, int));
-static Lisp_Object regulalize_fontname P_ ((Lisp_Object));
+static Lisp_Object regularize_fontname P_ ((Lisp_Object));
 
 
 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/
@@ -1043,7 +1043,7 @@
    string, maybe change FONTNAME to (FAMILY . REGISTRY).  */
 
 static Lisp_Object
-regulalize_fontname (Lisp_Object fontname)
+regularize_fontname (Lisp_Object fontname)
 {
   Lisp_Object family, registry;
 
@@ -1133,7 +1133,7 @@
   if (!NILP (frame))
     CHECK_LIVE_FRAME (frame);
 
-  elt = Fcons (make_number (from), regulalize_fontname (fontname));
+  elt = Fcons (make_number (from), regularize_fontname (fontname));
   for (; from <= to; from++)
     FONTSET_SET (fontset, from, elt);
   Foptimize_char_table (fontset);
@@ -1212,7 +1212,10 @@
 /* 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.
+   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,7 +1228,8 @@
 
    (2) The character code is invalid.
 
-   (3) The current buffer is not displayed in any window.
+   (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,31 +1244,42 @@
   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
+  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;
-  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)
@@ -1540,7 +1555,7 @@
 
       elt = XCAR (tail);
       target = Fcar (elt);
-      elt = Fcons (Qnil, regulalize_fontname (Fcdr (elt)));
+      elt = Fcons (Qnil, regularize_fontname (Fcdr (elt)));
       if (! CHAR_TABLE_P (target))
 	{
 	  int charset, c;