diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index b980467882c..c6dff0bae7f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -7687,6 +7687,53 @@ face_at_string_position (w, string, pos, bufpos, region_beg, | |||
| 7687 | } | 7687 | } |
| 7688 | 7688 | ||
| 7689 | 7689 | ||
| 7690 | /* Merge a face into a realized face. | ||
| 7691 | |||
| 7692 | F is frame where faces are (to be) realized. | ||
| 7693 | |||
| 7694 | FACE_NAME is named face to merge, or if nil, | ||
| 7695 | FACE_ID is face_id of realized face to merge. | ||
| 7696 | |||
| 7697 | BASE_FACE_ID is realized face to merge into. | ||
| 7698 | |||
| 7699 | Return new face. | ||
| 7700 | */ | ||
| 7701 | |||
| 7702 | int | ||
| 7703 | merge_into_realized_face (f, face_name, face_id, base_face_id) | ||
| 7704 | struct frame *f; | ||
| 7705 | Lisp_Object face_name; | ||
| 7706 | int face_id, base_face_id; | ||
| 7707 | { | ||
| 7708 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | ||
| 7709 | struct face *base_face; | ||
| 7710 | |||
| 7711 | base_face = FACE_FROM_ID (f, base_face_id); | ||
| 7712 | if (!base_face) | ||
| 7713 | return base_face_id; | ||
| 7714 | |||
| 7715 | /* Begin with attributes from the base face. */ | ||
| 7716 | bcopy (base_face->lface, attrs, sizeof attrs); | ||
| 7717 | |||
| 7718 | if (!NILP (face_name)) | ||
| 7719 | { | ||
| 7720 | if (!merge_named_face (f, face_name, attrs, 0)) | ||
| 7721 | return base_face_id; | ||
| 7722 | } | ||
| 7723 | else | ||
| 7724 | { | ||
| 7725 | struct face *face; | ||
| 7726 | face = FACE_FROM_ID (f, face_id); | ||
| 7727 | if (!face) | ||
| 7728 | return base_face_id; | ||
| 7729 | merge_face_vectors (f, face->lface, attrs, 0); | ||
| 7730 | } | ||
| 7731 | |||
| 7732 | /* Look up a realized face with the given face attributes, | ||
| 7733 | or realize a new one for ASCII characters. */ | ||
| 7734 | return lookup_face (f, attrs, 0, NULL); | ||
| 7735 | } | ||
| 7736 | |||
| 7690 | 7737 | ||
| 7691 | /*********************************************************************** | 7738 | /*********************************************************************** |
| 7692 | Tests | 7739 | Tests |