diff options
| author | Richard M. Stallman | 1994-04-10 01:19:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-10 01:19:57 +0000 |
| commit | 867dd1594f8abdf719ee24cc86a2fb1d73f1488d (patch) | |
| tree | 3df586a7c9f06a07751795f4c610f703339e3544 /src | |
| parent | 410d432151fc6380de8d698eac76888f5199475f (diff) | |
| download | emacs-867dd1594f8abdf719ee24cc86a2fb1d73f1488d.tar.gz emacs-867dd1594f8abdf719ee24cc86a2fb1d73f1488d.zip | |
(frame_update_line_height): Check param_faces[i] not null.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index b96ace2abf2..880bbc72c6e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -636,10 +636,11 @@ ensure_face_ready (f, id) | |||
| 636 | FRAME_PARAM_FACES (f) [id] = allocate_face (); | 636 | FRAME_PARAM_FACES (f) [id] = allocate_face (); |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | /* Computing faces appropriate for a given piece of text in a buffer. */ | 639 | /* Return non-zero if FONT1 and FONT2 have the same width. |
| 640 | 640 | We do not check the height, because we can now deal with | |
| 641 | /* Return non-zero if FONT1 and FONT2 have the same size bounding box. | 641 | different heights. |
| 642 | We assume that they're both character-cell fonts. */ | 642 | We assume that they're both character-cell fonts. */ |
| 643 | |||
| 643 | int | 644 | int |
| 644 | same_size_fonts (font1, font2) | 645 | same_size_fonts (font1, font2) |
| 645 | XFontStruct *font1, *font2; | 646 | XFontStruct *font1, *font2; |
| @@ -648,15 +649,6 @@ same_size_fonts (font1, font2) | |||
| 648 | XCharStruct *bounds2 = &font2->min_bounds; | 649 | XCharStruct *bounds2 = &font2->min_bounds; |
| 649 | 650 | ||
| 650 | return (bounds1->width == bounds2->width); | 651 | return (bounds1->width == bounds2->width); |
| 651 | /* Checking the following caused bad results in some cases | ||
| 652 | when fonts that should be the same size | ||
| 653 | actually have very slightly different size. | ||
| 654 | It is possible that this reintroduces the bug whereby line positions | ||
| 655 | were not right. However, the right way to fix that is to change xterm.c | ||
| 656 | so that the vertical positions of lines | ||
| 657 | depend only on the height of the frame's font. | ||
| 658 | && bounds1->ascent == bounds2->ascent | ||
| 659 | && bounds1->descent == bounds2->descent); */ | ||
| 660 | } | 652 | } |
| 661 | 653 | ||
| 662 | /* Update the line_height of frame F according to the biggest font in | 654 | /* Update the line_height of frame F according to the biggest font in |
| @@ -670,7 +662,8 @@ frame_update_line_height (f) | |||
| 670 | int biggest = FONT_HEIGHT (f->display.x->font); | 662 | int biggest = FONT_HEIGHT (f->display.x->font); |
| 671 | 663 | ||
| 672 | for (i = 0; i < f->display.x->n_param_faces; i++) | 664 | for (i = 0; i < f->display.x->n_param_faces; i++) |
| 673 | if (f->display.x->param_faces[i]->font != (XFontStruct *) FACE_DEFAULT) | 665 | if (f->display.x->param_faces[i] != 0 |
| 666 | && f->display.x->param_faces[i]->font != (XFontStruct *) FACE_DEFAULT) | ||
| 674 | { | 667 | { |
| 675 | int height = FONT_HEIGHT (f->display.x->param_faces[i]->font); | 668 | int height = FONT_HEIGHT (f->display.x->param_faces[i]->font); |
| 676 | if (height > biggest) | 669 | if (height > biggest) |
| @@ -683,14 +676,16 @@ frame_update_line_height (f) | |||
| 683 | f->display.x->line_height = biggest; | 676 | f->display.x->line_height = biggest; |
| 684 | x_set_window_size (f, 0, f->width, f->height); | 677 | x_set_window_size (f, 0, f->width, f->height); |
| 685 | } | 678 | } |
| 686 | 679 | ||
| 687 | /* Modify face TO by copying from FROM all properties which have | 680 | /* Modify face TO by copying from FROM all properties which have |
| 688 | nondefault settings. */ | 681 | nondefault settings. */ |
| 682 | |||
| 689 | static void | 683 | static void |
| 690 | merge_faces (from, to) | 684 | merge_faces (from, to) |
| 691 | struct face *from, *to; | 685 | struct face *from, *to; |
| 692 | { | 686 | { |
| 693 | /* Only merge the font if it's the same size as the base font. */ | 687 | /* Only merge the font if it's the same width as the base font. |
| 688 | Otherwise ignore it, since we can't handle it properly. */ | ||
| 694 | if (from->font != (XFontStruct *) FACE_DEFAULT | 689 | if (from->font != (XFontStruct *) FACE_DEFAULT |
| 695 | && same_size_fonts (from->font, to->font)) | 690 | && same_size_fonts (from->font, to->font)) |
| 696 | to->font = from->font; | 691 | to->font = from->font; |
| @@ -706,6 +701,7 @@ merge_faces (from, to) | |||
| 706 | 701 | ||
| 707 | /* Set up the basic set of facial parameters, based on the frame's | 702 | /* Set up the basic set of facial parameters, based on the frame's |
| 708 | data; all faces are deltas applied to this. */ | 703 | data; all faces are deltas applied to this. */ |
| 704 | |||
| 709 | static void | 705 | static void |
| 710 | compute_base_face (f, face) | 706 | compute_base_face (f, face) |
| 711 | FRAME_PTR f; | 707 | FRAME_PTR f; |
| @@ -724,7 +720,26 @@ compute_base_face (f, face) | |||
| 724 | face->cached_index = -1; | 720 | face->cached_index = -1; |
| 725 | } | 721 | } |
| 726 | 722 | ||
| 723 | /* Return the face ID to use to display a special glyph which selects | ||
| 724 | FACE_CODE as the face ID, assuming that ordinarily the face would | ||
| 725 | be CURRENT_FACE. F is the frame. */ | ||
| 726 | |||
| 727 | int | ||
| 728 | compute_glyph_face (f, face_code, current_face) | ||
| 729 | struct frame *f; | ||
| 730 | int face_code, current_face; | ||
| 731 | { | ||
| 732 | struct face face; | ||
| 733 | |||
| 734 | face = *FRAME_COMPUTED_FACES (f)[current_face]; | ||
| 735 | |||
| 736 | if (face_code >= 0 && face_code < FRAME_N_PARAM_FACES (f) | ||
| 737 | && FRAME_PARAM_FACES (f) [face_code] != 0) | ||
| 738 | merge_faces (FRAME_PARAM_FACES (f) [face_code], &face); | ||
| 727 | 739 | ||
| 740 | return intern_computed_face (f, &face); | ||
| 741 | } | ||
| 742 | |||
| 728 | /* Return the face ID associated with a buffer position POS. | 743 | /* Return the face ID associated with a buffer position POS. |
| 729 | Store into *ENDPTR the position at which a different face is needed. | 744 | Store into *ENDPTR the position at which a different face is needed. |
| 730 | This does not take account of glyphs that specify their own face codes. | 745 | This does not take account of glyphs that specify their own face codes. |
| @@ -861,28 +876,7 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse) | |||
| 861 | 876 | ||
| 862 | return intern_computed_face (f, &face); | 877 | return intern_computed_face (f, &face); |
| 863 | } | 878 | } |
| 864 | 879 | ||
| 865 | /* Return the face ID to use to display a special glyph which selects | ||
| 866 | FACE_CODE as the face ID, assuming that ordinarily the face would | ||
| 867 | be CURRENT_FACE. F is the frame. */ | ||
| 868 | |||
| 869 | int | ||
| 870 | compute_glyph_face (f, face_code, current_face) | ||
| 871 | struct frame *f; | ||
| 872 | int face_code, current_face; | ||
| 873 | { | ||
| 874 | struct face face; | ||
| 875 | |||
| 876 | face = *FRAME_COMPUTED_FACES (f)[current_face]; | ||
| 877 | |||
| 878 | if (face_code >= 0 && face_code < FRAME_N_PARAM_FACES (f) | ||
| 879 | && FRAME_PARAM_FACES (f) [face_code] != 0) | ||
| 880 | merge_faces (FRAME_PARAM_FACES (f) [face_code], &face); | ||
| 881 | |||
| 882 | return intern_computed_face (f, &face); | ||
| 883 | } | ||
| 884 | |||
| 885 | |||
| 886 | /* Recompute the GC's for the default and modeline faces. | 880 | /* Recompute the GC's for the default and modeline faces. |
| 887 | We call this after changing frame parameters on which those GC's | 881 | We call this after changing frame parameters on which those GC's |
| 888 | depend. */ | 882 | depend. */ |