# HG changeset patch # User Kim F. Storm # Date 1105236320 0 # Node ID 2f2c5349bc03ae451430a1dfa7bf0615f4a97fd1 # Parent 6aee7f43ad5994c3b964b473381322f004e62084 (merge_into_realized_face): New function. Used to merge escape-glyph face or face from display table into current face. diff -r 6aee7f43ad59 -r 2f2c5349bc03 src/xfaces.c --- a/src/xfaces.c Sun Jan 09 02:05:04 2005 +0000 +++ b/src/xfaces.c Sun Jan 09 02:05:20 2005 +0000 @@ -7687,6 +7687,53 @@ } +/* Merge a face into a realized face. + + F is frame where faces are (to be) realized. + + FACE_NAME is named face to merge, or if nil, + FACE_ID is face_id of realized face to merge. + + BASE_FACE_ID is realized face to merge into. + + Return new face. +*/ + +int +merge_into_realized_face (f, face_name, face_id, base_face_id) + struct frame *f; + Lisp_Object face_name; + int face_id, base_face_id; +{ + Lisp_Object attrs[LFACE_VECTOR_SIZE]; + struct face *base_face; + + base_face = FACE_FROM_ID (f, base_face_id); + if (!base_face) + return base_face_id; + + /* Begin with attributes from the base face. */ + bcopy (base_face->lface, attrs, sizeof attrs); + + if (!NILP (face_name)) + { + if (!merge_named_face (f, face_name, attrs, 0)) + return base_face_id; + } + else + { + struct face *face; + face = FACE_FROM_ID (f, face_id); + if (!face) + return base_face_id; + merge_face_vectors (f, face->lface, attrs, 0); + } + + /* Look up a realized face with the given face attributes, + or realize a new one for ASCII characters. */ + return lookup_face (f, attrs, 0, NULL); +} + /*********************************************************************** Tests