changeset 17103:7cde34a6424e

(dumpglyphs): Pay attention to characters registered in use-default-ascent. Fill background in advance if font has non-zero _MULE_BASELINE_OFFSET property. (x_load_font, x_term_init): Handle font property _MULE_DEFAULT_ASCENT.
author Kenichi Handa <handa@m17n.org>
date Thu, 27 Feb 1997 06:53:04 +0000
parents 82769113e12f
children b2a15ee1d181
files src/xterm.c
diffstat 1 files changed, 30 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Thu Feb 27 06:50:46 1997 +0000
+++ b/src/xterm.c	Thu Feb 27 06:53:04 1997 +0000
@@ -557,7 +557,7 @@
       /* Get the face-code of the next GLYPH.  */
       int cf, len;
       GLYPH g = *gp;
-      int ch, charset;
+      int ch, first_ch, charset;
       /* HIGHEST and LOWEST are used while drawing a composite
          character.  The meanings are described later.  */
       int highest, lowest;
@@ -565,6 +565,7 @@
       GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
       cf = (cmpcharp ? cmpcharp->face_work : FAST_GLYPH_FACE (g));
       ch = FAST_GLYPH_CHAR (g);
+      if (gidx == 0) first_ch = ch;
       charset = CHAR_CHARSET (ch);
       if (charset == CHARSET_COMPOSITION)
 	{
@@ -635,12 +636,14 @@
 	   1) A face has stipple.
 	   2) A height of font is different from that of the current line.
 	   3) Drawing a composite character.
+	   4) Font has non-zero _MULE_BASELINE_OFFSET property.
 	   After filling background, we draw glyphs by XDrawString16.  */
 	int background_filled;
 	/* Baseline position of a character, offset from TOP.  */
 	int baseline;
-	/* The property value of `_MULE_RELATIVE_COMPOSE'.  */
-	int relative_compose = 0;
+	/* The property value of `_MULE_RELATIVE_COMPOSE' and
+           `_MULE_DEFAULT_ASCENT'.  */
+	int relative_compose = 0, default_ascent = 0;
 
 	/* HL = 3 means use a mouse face previously chosen.  */
 	if (hl == 3)
@@ -695,7 +698,10 @@
 	      baseline = (f->output_data.x->font_baseline
 			  - fontp->baseline_offset);
 	    if (cmpcharp && cmpcharp->cmp_rule == NULL)
-	      relative_compose = fontp->relative_compose;
+	      {
+		relative_compose = fontp->relative_compose;
+		default_ascent = fontp->default_ascent;
+	      }
 
 	    /* We have to change code points in the following cases.  */
 	    if (fontp->font_encoder)
@@ -812,7 +818,8 @@
 	else if (!font
 		 || stippled
 		 || f->output_data.x->line_height != FONT_HEIGHT (font)
-		 || cmpcharp)
+		 || cmpcharp
+		 || baseline != f->output_data.x->font_baseline)
 	  {
 	    if (!stippled)
 	      /* This is to fill a rectangle with background color.  */
@@ -853,9 +860,19 @@
 		       written, LOWEST the lowest position.  */
 		    int x_offset = 0;
 
-		    pcm = PER_CHAR_METRIC (font, buf);
-		    highest = pcm->ascent + 1;
-		    lowest = - pcm->descent;
+		    if (default_ascent
+			&& CHAR_TABLE_P (Vuse_default_ascent)
+			&& !NILP (Faref (Vuse_default_ascent, first_ch)))
+		      {
+			highest = default_ascent;
+			lowest = 0;
+		      }
+		    else
+		      {
+			pcm = PER_CHAR_METRIC (font, buf);
+			highest = pcm->ascent + 1;
+			lowest = - pcm->descent;
+		      }
 
 		    if (cmpcharp->cmp_rule)
 		      x_offset = (cmpcharp->col_offset[0]
@@ -6380,6 +6397,9 @@
     fontp->relative_compose
       = (XGetFontProperty (font, dpyinfo->Xatom_MULE_RELATIVE_COMPOSE, &value)
 	 ? (long) value : 0);
+    fontp->default_ascent
+      = (XGetFontProperty (font, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value)
+	 ? (long) value : 0);
 
     UNBLOCK_INPUT;
     dpyinfo->n_fonts++;
@@ -6678,6 +6698,8 @@
     = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False);
   dpyinfo->Xatom_MULE_RELATIVE_COMPOSE
     = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False);
+  dpyinfo->Xatom_MULE_DEFAULT_ASCENT
+    = XInternAtom (dpyinfo->display, "_MULE_DEFAULT_ASCENT", False);
 
   dpyinfo->cut_buffers_initialized = 0;