# HG changeset patch # User Kenichi Handa # Date 860397133 0 # Node ID f27f4c559b21735159e8facff990ff22f75d3315 # Parent a3ca5e15c82aeb7ff45cfdb084b3bdaf7623d8f4 (dumpglyphs): Clip and highlight glyphs displayed with fonts of wrong size. diff -r a3ca5e15c82a -r f27f4c559b21 src/xterm.c --- a/src/xterm.c Mon Apr 07 05:36:52 1997 +0000 +++ b/src/xterm.c Mon Apr 07 07:12:13 1997 +0000 @@ -607,7 +607,7 @@ || (cmpcharp == NULL && FAST_GLYPH_FACE (g) != cf)) break; - if (c2) + if (c2 > 0) cp->byte1 = c1, cp->byte2 = c2; else cp->byte1 = 0, cp->byte2 = c1; @@ -629,7 +629,8 @@ int line_height = f->output_data.x->line_height; /* Pixel width of each glyph in this run. */ int glyph_width - = FONT_WIDTH (f->output_data.x->font) * CHARSET_WIDTH (charset); + = (FONT_WIDTH (f->output_data.x->font) + * (cmpcharp ? cmpcharp->width : CHARSET_WIDTH (charset))); /* Overall pixel width of this run. */ int run_width = (FONT_WIDTH (f->output_data.x->font) @@ -681,6 +682,8 @@ stippled = 1; } +#define FACE_DEFAULT (~0) + /* Setting appropriate font and gc for this charset. */ if (charset != CHARSET_ASCII) { @@ -745,21 +748,20 @@ else { font = FACE_FONT (face); + if (font == (XFontStruct *) FACE_DEFAULT) + font = f->output_data.x->font; baseline = FONT_BASE (font); font_not_found: - gc = FACE_GC (face); + gc = FACE_GC (face); } -#define FACE_DEFAULT (~0) - /* Now override that if the cursor's on this character. */ if (hl == 2) { /* The cursor overrides stippling. */ stippled = 0; - if ((font == (XFontStruct *) FACE_DEFAULT - || font == f->output_data.x->font) + if (font == f->output_data.x->font && face->background == f->output_data.x->background_pixel && face->foreground == f->output_data.x->foreground_pixel) { @@ -811,13 +813,12 @@ } } - if (font == (XFontStruct *) FACE_DEFAULT) - font = f->output_data.x->font; - if (font) - require_clipping = (FONT_HEIGHT (font) > line_height - || FONT_WIDTH (font) > glyph_width - || baseline != f->output_data.x->font_baseline); + require_clipping = (!NILP (Vclip_large_size_font) + && (font->ascent > baseline + || font->descent > line_height - baseline + || (!cmpcharp + && FONT_WIDTH (font) > glyph_width))); if (font && (just_foreground || (cmpcharp && gidx > 0))) background_filled = 1; @@ -838,7 +839,6 @@ else if (!font || FONT_HEIGHT (font) < line_height || FONT_WIDTH (font) < glyph_width - || baseline != f->output_data.x->font_baseline || cmpcharp) { /* Fill a area for the current run in background pixle of GC. */ @@ -849,7 +849,7 @@ /* The current code at first exchange foreground and background of GC, fill the area, then recover the original foreground and background of GC. - Aren't there more smart ways? */ + Aren't there any more smart ways? */ XGetGCValues (FRAME_X_DISPLAY (f), gc, mask, &xgcv); fore = xgcv.foreground, back = xgcv.background; @@ -1017,7 +1017,7 @@ } #endif } - if (!font || require_clipping) + if (!font || require_clipping && !NILP (Vhighlight_wrong_size_font)) { /* Show rectangles to show that we found no font or a font of inappropriate size. */