diff options
| author | Kenichi Handa | 1997-04-07 07:12:13 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-04-07 07:12:13 +0000 |
| commit | 57b03282a0f5abaf689a0c411a2f771e1c555d98 (patch) | |
| tree | 69898d91ff10ac0d349fe6afe59b432fba02dc3c /src | |
| parent | 3fdc9c8f410b3cd416408b7bc6801c9847d92a52 (diff) | |
| download | emacs-57b03282a0f5abaf689a0c411a2f771e1c555d98.tar.gz emacs-57b03282a0f5abaf689a0c411a2f771e1c555d98.zip | |
(dumpglyphs): Clip and highlight glyphs displayed with
fonts of wrong size.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/xterm.c b/src/xterm.c index a854b7b9c50..ec8cfc43c05 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -607,7 +607,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 607 | || (cmpcharp == NULL && FAST_GLYPH_FACE (g) != cf)) | 607 | || (cmpcharp == NULL && FAST_GLYPH_FACE (g) != cf)) |
| 608 | break; | 608 | break; |
| 609 | 609 | ||
| 610 | if (c2) | 610 | if (c2 > 0) |
| 611 | cp->byte1 = c1, cp->byte2 = c2; | 611 | cp->byte1 = c1, cp->byte2 = c2; |
| 612 | else | 612 | else |
| 613 | cp->byte1 = 0, cp->byte2 = c1; | 613 | cp->byte1 = 0, cp->byte2 = c1; |
| @@ -629,7 +629,8 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 629 | int line_height = f->output_data.x->line_height; | 629 | int line_height = f->output_data.x->line_height; |
| 630 | /* Pixel width of each glyph in this run. */ | 630 | /* Pixel width of each glyph in this run. */ |
| 631 | int glyph_width | 631 | int glyph_width |
| 632 | = FONT_WIDTH (f->output_data.x->font) * CHARSET_WIDTH (charset); | 632 | = (FONT_WIDTH (f->output_data.x->font) |
| 633 | * (cmpcharp ? cmpcharp->width : CHARSET_WIDTH (charset))); | ||
| 633 | /* Overall pixel width of this run. */ | 634 | /* Overall pixel width of this run. */ |
| 634 | int run_width | 635 | int run_width |
| 635 | = (FONT_WIDTH (f->output_data.x->font) | 636 | = (FONT_WIDTH (f->output_data.x->font) |
| @@ -681,6 +682,8 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 681 | stippled = 1; | 682 | stippled = 1; |
| 682 | } | 683 | } |
| 683 | 684 | ||
| 685 | #define FACE_DEFAULT (~0) | ||
| 686 | |||
| 684 | /* Setting appropriate font and gc for this charset. */ | 687 | /* Setting appropriate font and gc for this charset. */ |
| 685 | if (charset != CHARSET_ASCII) | 688 | if (charset != CHARSET_ASCII) |
| 686 | { | 689 | { |
| @@ -745,21 +748,20 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 745 | else | 748 | else |
| 746 | { | 749 | { |
| 747 | font = FACE_FONT (face); | 750 | font = FACE_FONT (face); |
| 751 | if (font == (XFontStruct *) FACE_DEFAULT) | ||
| 752 | font = f->output_data.x->font; | ||
| 748 | baseline = FONT_BASE (font); | 753 | baseline = FONT_BASE (font); |
| 749 | font_not_found: | 754 | font_not_found: |
| 750 | gc = FACE_GC (face); | 755 | gc = FACE_GC (face); |
| 751 | } | 756 | } |
| 752 | 757 | ||
| 753 | #define FACE_DEFAULT (~0) | ||
| 754 | |||
| 755 | /* Now override that if the cursor's on this character. */ | 758 | /* Now override that if the cursor's on this character. */ |
| 756 | if (hl == 2) | 759 | if (hl == 2) |
| 757 | { | 760 | { |
| 758 | /* The cursor overrides stippling. */ | 761 | /* The cursor overrides stippling. */ |
| 759 | stippled = 0; | 762 | stippled = 0; |
| 760 | 763 | ||
| 761 | if ((font == (XFontStruct *) FACE_DEFAULT | 764 | if (font == f->output_data.x->font |
| 762 | || font == f->output_data.x->font) | ||
| 763 | && face->background == f->output_data.x->background_pixel | 765 | && face->background == f->output_data.x->background_pixel |
| 764 | && face->foreground == f->output_data.x->foreground_pixel) | 766 | && face->foreground == f->output_data.x->foreground_pixel) |
| 765 | { | 767 | { |
| @@ -811,13 +813,12 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 811 | } | 813 | } |
| 812 | } | 814 | } |
| 813 | 815 | ||
| 814 | if (font == (XFontStruct *) FACE_DEFAULT) | ||
| 815 | font = f->output_data.x->font; | ||
| 816 | |||
| 817 | if (font) | 816 | if (font) |
| 818 | require_clipping = (FONT_HEIGHT (font) > line_height | 817 | require_clipping = (!NILP (Vclip_large_size_font) |
| 819 | || FONT_WIDTH (font) > glyph_width | 818 | && (font->ascent > baseline |
| 820 | || baseline != f->output_data.x->font_baseline); | 819 | || font->descent > line_height - baseline |
| 820 | || (!cmpcharp | ||
| 821 | && FONT_WIDTH (font) > glyph_width))); | ||
| 821 | 822 | ||
| 822 | if (font && (just_foreground || (cmpcharp && gidx > 0))) | 823 | if (font && (just_foreground || (cmpcharp && gidx > 0))) |
| 823 | background_filled = 1; | 824 | background_filled = 1; |
| @@ -838,7 +839,6 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 838 | else if (!font | 839 | else if (!font |
| 839 | || FONT_HEIGHT (font) < line_height | 840 | || FONT_HEIGHT (font) < line_height |
| 840 | || FONT_WIDTH (font) < glyph_width | 841 | || FONT_WIDTH (font) < glyph_width |
| 841 | || baseline != f->output_data.x->font_baseline | ||
| 842 | || cmpcharp) | 842 | || cmpcharp) |
| 843 | { | 843 | { |
| 844 | /* Fill a area for the current run in background pixle of GC. */ | 844 | /* Fill a area for the current run in background pixle of GC. */ |
| @@ -849,7 +849,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 849 | /* The current code at first exchange foreground and | 849 | /* The current code at first exchange foreground and |
| 850 | background of GC, fill the area, then recover the | 850 | background of GC, fill the area, then recover the |
| 851 | original foreground and background of GC. | 851 | original foreground and background of GC. |
| 852 | Aren't there more smart ways? */ | 852 | Aren't there any more smart ways? */ |
| 853 | 853 | ||
| 854 | XGetGCValues (FRAME_X_DISPLAY (f), gc, mask, &xgcv); | 854 | XGetGCValues (FRAME_X_DISPLAY (f), gc, mask, &xgcv); |
| 855 | fore = xgcv.foreground, back = xgcv.background; | 855 | fore = xgcv.foreground, back = xgcv.background; |
| @@ -1017,7 +1017,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 1017 | } | 1017 | } |
| 1018 | #endif | 1018 | #endif |
| 1019 | } | 1019 | } |
| 1020 | if (!font || require_clipping) | 1020 | if (!font || require_clipping && !NILP (Vhighlight_wrong_size_font)) |
| 1021 | { | 1021 | { |
| 1022 | /* Show rectangles to show that we found no font or a font | 1022 | /* Show rectangles to show that we found no font or a font |
| 1023 | of inappropriate size. */ | 1023 | of inappropriate size. */ |