]> Pileus Git - ~andy/gtk/commitdiff
Fix the second bug, draw underlines.
authorElliot Lee <sopwith@src.gnome.org>
Thu, 3 Aug 2000 20:43:47 +0000 (20:43 +0000)
committerElliot Lee <sopwith@src.gnome.org>
Thu, 3 Aug 2000 20:43:47 +0000 (20:43 +0000)
Fix the second bug, draw underlines.

gdk/gdkpango.c

index 97bec9a165c297f45d2abff405fd79fad76224f5..53af8371d4385ad744429b75a5d4a6d7b4e5e41c 100644 (file)
@@ -37,7 +37,9 @@ static void gdk_pango_get_item_properties (PangoItem      *item,
                                           gboolean       *fg_set,
                                           PangoAttrColor *bg_color,
                                           gboolean       *bg_set,
-                                          gboolean       *shape_set);
+                                          gboolean       *shape_set,
+                                          PangoRectangle *ink_rect,
+                                          PangoRectangle *logical_rect);
 
 static void
 gdk_pango_context_destroy (GdkPangoContextInfo *info)
@@ -174,14 +176,18 @@ gdk_draw_layout_line (GdkDrawable      *drawable,
       
       tmp_list = tmp_list->next;
 
-      gdk_pango_get_item_properties (run->item, &uline, &fg_color, &fg_set, &bg_color, &bg_set, &shape_set);
+      gdk_pango_get_item_properties (run->item, &uline, &fg_color, &fg_set, &bg_color, &bg_set, &shape_set, &ink_rect,
+                                    &logical_rect);
 
-      if (uline == PANGO_UNDERLINE_NONE)
-       pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
-                                   NULL, &logical_rect);
-      else
-       pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
-                                   &ink_rect, &logical_rect);
+      if (!shape_set)
+       {
+         if (uline == PANGO_UNDERLINE_NONE)
+           pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
+                                       NULL, &logical_rect);
+         else
+           pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
+                                       &ink_rect, &logical_rect);
+       }
 
       if (bg_set)
        {
@@ -196,16 +202,14 @@ gdk_draw_layout_line (GdkDrawable      *drawable,
          gdk_pango_free_gc (context, bg_gc);
        }
 
-      if (shape_set)
-       goto next_run;
-
       if (fg_set)
        fg_gc = gdk_pango_get_gc (context, &fg_color, gc);
       else
        fg_gc = gc;
 
-      gdk_draw_glyphs (drawable, fg_gc, run->item->analysis.font,
-                      x + x_off / PANGO_SCALE, y, run->glyphs);
+      if (!shape_set)
+       gdk_draw_glyphs (drawable, fg_gc, run->item->analysis.font,
+                        x + x_off / PANGO_SCALE, y, run->glyphs);
 
       switch (uline)
        {
@@ -231,7 +235,6 @@ gdk_draw_layout_line (GdkDrawable      *drawable,
       if (fg_set)
        gdk_pango_free_gc (context, fg_gc);
 
-    next_run:
       x_off += logical_rect.width;
     }
 }
@@ -329,7 +332,9 @@ gdk_pango_get_item_properties (PangoItem      *item,
                               gboolean       *fg_set,
                               PangoAttrColor *bg_color,
                               gboolean       *bg_set,
-                              gboolean       *shape_set)
+                              gboolean       *shape_set,
+                              PangoRectangle *ink_rect,
+                              PangoRectangle *logical_rect)
 {
   GSList *tmp_list = item->extra_attrs;
 
@@ -372,6 +377,10 @@ gdk_pango_get_item_properties (PangoItem      *item,
        case PANGO_ATTR_SHAPE:
          if (shape_set)
            *shape_set = TRUE;
+         if (logical_rect)
+           *logical_rect = ((PangoAttrShape *)attr)->logical_rect;
+         if (ink_rect)
+           *ink_rect = ((PangoAttrShape *)attr)->ink_rect;
          break;
          
        default: