diff options
| author | Jim Blandy | 1993-05-19 03:07:10 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-19 03:07:10 +0000 |
| commit | 68a973351fcc8327e72ed65266983e946d0780d5 (patch) | |
| tree | c915567eedb5ce89e30b378ff6844297acce0396 /src | |
| parent | decb54c69005d5c0ffe96ea4fd4dbfb34d0540e5 (diff) | |
| download | emacs-68a973351fcc8327e72ed65266983e946d0780d5.tar.gz emacs-68a973351fcc8327e72ed65266983e946d0780d5.zip | |
Make sure that all the display faces use fonts of the
same dimensions as the default face, so as not to confuse the rest
of the redisplay code.
* xfaces.c (same_size_fonts): New function.
(merge_faces): Only merge in a new font from the FROM face if it
is the same size as the font in the TO face.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 31 |
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. */ | ||
| 424 | void | 429 | void |
| 425 | init_frame_faces (f) | 430 | init_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. */ | ||
| 557 | static int | ||
| 558 | same_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. */ |
| 552 | static void | 572 | static void |
| 553 | merge_faces (from, to) | 573 | merge_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) |