aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xfaces.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 2339b578299..48068b014f8 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -420,7 +420,12 @@ unload_color (f, pixel)
420 420
421/* Initializing face arrays for frames. */ 421/* Initializing face arrays for frames. */
422 422
423/* Set up faces 0 and 1 based on the normal text and modeline GC's. */ 423/* Set up faces 0 and 1 based on the normal text and modeline GC's.
424 This gets called whenever the parameters stored in the frame itself
425 (i.e. font, background color, etcetera) change.
426
427 Note that the first two faces just contain references to the
428 frame's own resources. We shouldn't free them. */
424void 429void
425init_frame_faces (f) 430init_frame_faces (f)
426 struct frame *f; 431 struct frame *f;
@@ -547,16 +552,32 @@ ensure_face_ready (f, id)
547 552
548/* Computing faces appropriate for a given piece of text in a buffer. */ 553/* Computing faces appropriate for a given piece of text in a buffer. */
549 554
555/* Return non-zero if FONT1 and FONT2 have the same size bounding box.
556 We assume that they're both character-cell fonts. */
557static int
558same_size_fonts (font1, font2)
559 XFontStruct *font1, *font2;
560{
561 XCharStruct *bounds1 = font1->min_bounds;
562 XCharStruct *bounds2 = font2->min_bounds;
563
564 return (bounds1->width == bounds2->width
565 && bounds1->ascent == bounds2->ascent
566 && bounds1->descent == bounds2->descent);
567}
568
569
550/* Modify face TO by copying from FROM all properties which have 570/* Modify face TO by copying from FROM all properties which have
551 nondefault settings. */ 571 nondefault settings. */
552static void 572static void
553merge_faces (from, to) 573merge_faces (from, to)
554 struct face *from, *to; 574 struct face *from, *to;
555{ 575{
556 if (from->font != (XFontStruct *)FACE_DEFAULT) 576 /* Only merge the font if it's the same size as the base font. */
557 { 577 if (from->font != (XFontStruct *) FACE_DEFAULT
558 to->font = from->font; 578 && ! from->font->per_char
559 } 579 && same_size_fonts (from->font, to->font))
580 to->font = from->font;
560 if (from->foreground != FACE_DEFAULT) 581 if (from->foreground != FACE_DEFAULT)
561 to->foreground = from->foreground; 582 to->foreground = from->foreground;
562 if (from->background != FACE_DEFAULT) 583 if (from->background != FACE_DEFAULT)