changeset 36045:8be6a1c85409

(x_produce_image_glyph): Pay attention to the case that face->box_line_width is negative. (x_produce_stretch_glyph): Likewise. (x_produce_glyphs): Likewise. (x_estimate_mode_line_height): Likewise. (x_draw_glyph_string_background): Likewise. (x_draw_glyph_string_foreground): Likewise. (x_draw_composite_glyph_string_foreground): Likewise. (x_draw_glyph_string_box): Likewise. (x_draw_image_foreground): Likewise. (x_draw_image_relief): Likewise. (x_draw_image_foreground_1): Likewise. (x_draw_image_glyph_string): Likewise.
author Andrew Innes <andrewi@gnu.org>
date Mon, 12 Feb 2001 14:49:50 +0000
parents 84aab29a2e96
children e86b87b9797e
files src/w32term.c
diffstat 1 files changed, 62 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32term.c	Mon Feb 12 11:23:07 2001 +0000
+++ b/src/w32term.c	Mon Feb 12 14:49:50 2001 +0000
@@ -1721,13 +1721,16 @@
   
   if (face->box != FACE_NO_BOX)
     {
-      it->ascent += face->box_line_width;
-      it->descent += face->box_line_width;
+      if (face->box_line_width > 0)
+	{
+	  it->ascent += face->box_line_width;
+	  it->descent += face->box_line_width;
+	}
       
       if (it->start_of_box_run_p)
-	it->pixel_width += face->box_line_width;
+	it->pixel_width += abs (face->box_line_width);
       if (it->end_of_box_run_p)
-	it->pixel_width += face->box_line_width;
+	it->pixel_width += abs (face->box_line_width);
     }
 
   take_vertical_position_into_account (it);
@@ -1934,13 +1937,16 @@
 
   if (face->box != FACE_NO_BOX)
     {
-      it->ascent += face->box_line_width;
-      it->descent += face->box_line_width;
+      if (face->box_line_width > 0)
+	{
+	  it->ascent += face->box_line_width;
+	  it->descent += face->box_line_width;
+	}
       
       if (it->start_of_box_run_p)
-	it->pixel_width += face->box_line_width;
+	it->pixel_width += abs (face->box_line_width);
       if (it->end_of_box_run_p)
-	it->pixel_width += face->box_line_width;
+	it->pixel_width += abs (face->box_line_width);
     }
   
   take_vertical_position_into_account (it);
@@ -2098,8 +2104,13 @@
 	    {
 	      int thick = face->box_line_width;
 	      
-	      it->ascent += thick;
-	      it->descent += thick;
+	      if (thick > 0)
+		{
+		  it->ascent += thick;
+		  it->descent += thick;
+		}
+	      else
+		thick = -thick;
 	      
 	      if (it->start_of_box_run_p)
 		it->pixel_width += thick;
@@ -2144,11 +2155,11 @@
 	  it->ascent = it->phys_ascent = FONT_BASE (font) + boff;
 	  it->descent = it->phys_descent = FONT_DESCENT (font) - boff;
       
-	  if (face->box != FACE_NO_BOX)
+	  if (face->box != FACE_NO_BOX
+	      && face->box_line_width > 0)
 	    {
-	      int thick = face->box_line_width;
-	      it->ascent += thick;
-	      it->descent += thick;
+	      it->ascent += face->box_line_width;
+	      it->descent += face->box_line_width;
 	    }
 	}
       else if (it->char_to_display == '\t')
@@ -2220,8 +2231,14 @@
 	  if (face->box != FACE_NO_BOX)
 	    {
 	      int thick = face->box_line_width;
-	      it->ascent += thick;
-	      it->descent += thick;
+
+	      if (thick > 0)
+		{
+		  it->ascent += thick;
+		  it->descent += thick;
+		}
+	      else
+		thick = - thick;
 	  
 	      if (it->start_of_box_run_p)
 		it->pixel_width += thick;
@@ -2502,8 +2519,14 @@
       if (face->box != FACE_NO_BOX)
 	{
 	  int thick = face->box_line_width;
-	  it->ascent += thick;
-	  it->descent += thick;
+
+	  if (thick > 0)
+	    {
+	      it->ascent += thick;
+	      it->descent += thick;
+	    }
+	  else
+	    thick = - thick;
 	  
 	  if (it->start_of_box_run_p)
 	    it->pixel_width += thick;
@@ -2560,7 +2583,8 @@
           {
             if (face->font)
               height = FONT_HEIGHT (face->font);
-            height += 2 * face->box_line_width;
+	    if (face->box_line_width > 0)
+	      height += 2 * face->box_line_width;
           }
       }
   
@@ -3351,29 +3375,31 @@
      shouldn't be drawn in the first place.  */
   if (!s->background_filled_p)
     {
+      int box_line_width = max (s->face->box_line_width, 0);
+
 #if 0 /* TODO: stipple */
       if (s->stippled_p)
 	{
 	  /* Fill background with a stipple pattern.  */
 	  XSetFillStyle (s->display, s->gc, FillOpaqueStippled);
 	  XFillRectangle (s->display, s->window, s->gc, s->x,
-			  s->y + s->face->box_line_width,
+			  s->y + box_line_width,
 			  s->background_width,
-			  s->height - 2 * s->face->box_line_width);
+			  s->height - 2 * box_line_width);
 	  XSetFillStyle (s->display, s->gc, FillSolid);
 	  s->background_filled_p = 1;
 	}
       else
 #endif
-        if (FONT_HEIGHT (s->font) < s->height - 2 * s->face->box_line_width
+        if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
 	       || s->font_not_found_p
 	       || s->extends_to_end_of_line_p
                || s->font->bdf
 	       || force_p)
 	{
-	  x_clear_glyph_string_rect (s, s->x, s->y + s->face->box_line_width,
+	  x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
 				     s->background_width,
-				     s->height - 2 * s->face->box_line_width);
+				     s->height - 2 * box_line_width);
 	  s->background_filled_p = 1;
 	}
     }
@@ -3393,7 +3419,7 @@
      of S to the right of that box line.  */
   if (s->face->box != FACE_NO_BOX
       && s->first_glyph->left_box_line_p)
-    x = s->x + s->face->box_line_width;
+    x = s->x + abs (s->face->box_line_width);
   else
     x = s->x;
 
@@ -3455,7 +3481,7 @@
      of S to the right of that box line.  */
   if (s->face->box != FACE_NO_BOX
       && s->first_glyph->left_box_line_p)
-    x = s->x + s->face->box_line_width;
+    x = s->x + abs (s->face->box_line_width);
   else
     x = s->x;
 
@@ -3789,7 +3815,7 @@
 		? s->first_glyph
 		: s->first_glyph + s->nchars - 1);
 
-  width = s->face->box_line_width;
+  width = abs (s->face->box_line_width);
   raised_p = s->face->box == FACE_RAISED_BOX;
   left_x = s->x;
   right_x = ((s->row->full_width_p
@@ -3834,7 +3860,7 @@
      right of that line.  */
   if (s->face->box != FACE_NO_BOX
       && s->first_glyph->left_box_line_p)
-    x = s->x + s->face->box_line_width;
+    x = s->x + abs (s->face->box_line_width);
   else
     x = s->x;
 
@@ -3936,7 +3962,7 @@
      right of that line.  */
   if (s->face->box != FACE_NO_BOX
       && s->first_glyph->left_box_line_p)
-    x = s->x + s->face->box_line_width;
+    x = s->x + abs (s->face->box_line_width);
   else
     x = s->x;
   
@@ -3984,7 +4010,7 @@
      right of that line.  */
   if (s->face->box != FACE_NO_BOX
       && s->first_glyph->left_box_line_p)
-    x = s->face->box_line_width;
+    x = abs (s->face->box_line_width);
   else
     x = 0;
 
@@ -4102,11 +4128,12 @@
      struct glyph_string *s;
 {
   int x, y;
-  int box_line_width = s->face->box_line_width;
+  int box_line_hwidth = abs (s->face->box_line_width);
+  int box_line_vwidth = max (s->face->box_line_width, 0);
   int height;
   HBITMAP pixmap = 0;
 
-  height = s->height - 2 * box_line_width;
+  height = s->height - 2 * box_line_vwidth;
 
   /* Fill background with face under the image.  Do it only if row is
      taller than image or if image has a clip mask to reduce
@@ -4121,12 +4148,12 @@
       || s->img->pixmap == 0
       || s->width != s->background_width)
     {
-      if (box_line_width && s->first_glyph->left_box_line_p)
-	x = s->x + box_line_width;
+      if (box_line_hwidth && s->first_glyph->left_box_line_p)
+	x = s->x + box_line_hwidth;
       else
 	x = s->x;
       
-      y = s->y + box_line_width;
+      y = s->y + box_line_vwidth;
 #if 0 /* TODO: image mask */
       if (s->img->mask)
 	{