comparison src/xfaces.c @ 90072:cb67264d6096

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-2 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12 Remove "-face" suffix from lazy-highlight face name * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40 Fix regressions from latest reftex update * miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2 Merge from miles@gnu.org--gnu-2004 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3 Merge from emacs--cvs-trunk--0
author Miles Bader <miles@gnu.org>
date Sun, 16 Jan 2005 03:40:12 +0000
parents 95879cc1ed20 df565ffe7247
children 609c840fe65f
comparison
equal deleted inserted replaced
90071:f6b4d0ebf147 90072:cb67264d6096
7879 or realize a new one for ASCII characters. */ 7879 or realize a new one for ASCII characters. */
7880 return lookup_face (f, attrs); 7880 return lookup_face (f, attrs);
7881 } 7881 }
7882 7882
7883 7883
7884 /* Merge a face into a realized face.
7885
7886 F is frame where faces are (to be) realized.
7887
7888 FACE_NAME is named face to merge.
7889
7890 If FACE_NAME is nil, FACE_ID is face_id of realized face to merge.
7891
7892 If FACE_NAME is t, FACE_ID is lface_id of face to merge.
7893
7894 BASE_FACE_ID is realized face to merge into.
7895
7896 Return new face id.
7897 */
7898
7899 int
7900 merge_faces (f, face_name, face_id, base_face_id)
7901 struct frame *f;
7902 Lisp_Object face_name;
7903 int face_id, base_face_id;
7904 {
7905 Lisp_Object attrs[LFACE_VECTOR_SIZE];
7906 struct face *base_face;
7907
7908 base_face = FACE_FROM_ID (f, base_face_id);
7909 if (!base_face)
7910 return base_face_id;
7911
7912 if (EQ (face_name, Qt))
7913 {
7914 if (face_id < 0 || face_id >= lface_id_to_name_size)
7915 return base_face_id;
7916 face_name = lface_id_to_name[face_id];
7917 face_id = lookup_derived_face (f, face_name, 0, base_face_id);
7918 if (face_id >= 0)
7919 return face_id;
7920 return base_face_id;
7921 }
7922
7923 /* Begin with attributes from the base face. */
7924 bcopy (base_face->lface, attrs, sizeof attrs);
7925
7926 if (!NILP (face_name))
7927 {
7928 if (!merge_named_face (f, face_name, attrs, 0))
7929 return base_face_id;
7930 }
7931 else
7932 {
7933 struct face *face;
7934 if (face_id < 0)
7935 return base_face_id;
7936 face = FACE_FROM_ID (f, face_id);
7937 if (!face)
7938 return base_face_id;
7939 merge_face_vectors (f, face->lface, attrs, 0);
7940 }
7941
7942 /* Look up a realized face with the given face attributes,
7943 or realize a new one for ASCII characters. */
7944 return lookup_face (f, attrs, 0, NULL);
7945 }
7946
7884 7947
7885 /*********************************************************************** 7948 /***********************************************************************
7886 Tests 7949 Tests
7887 ***********************************************************************/ 7950 ***********************************************************************/
7888 7951