[pango/line-underline: 3/3] renderer: Handle new underline values



commit dff623751fb3b5226c53566f3bfc6ff28e162d45
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 19 23:53:52 2019 +0200

    renderer: Handle new underline values
    
    Handle these by using the lowest position across
    a sequence of runs with the same underline.

 pango/pango-renderer.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 889989dd..df1eb538 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -216,6 +216,7 @@ draw_underline (PangoRenderer *renderer,
     case PANGO_UNDERLINE_NONE:
       break;
     case PANGO_UNDERLINE_DOUBLE:
+    case PANGO_UNDERLINE_DOUBLE_LINE:
       pango_renderer_draw_rectangle (renderer,
                                     PANGO_RENDER_PART_UNDERLINE,
                                     rect->x,
@@ -225,6 +226,7 @@ draw_underline (PangoRenderer *renderer,
       /* Fall through */
     case PANGO_UNDERLINE_SINGLE:
     case PANGO_UNDERLINE_LOW:
+    case PANGO_UNDERLINE_SINGLE_LINE:
       pango_renderer_draw_rectangle (renderer,
                                     PANGO_RENDER_PART_UNDERLINE,
                                     rect->x,
@@ -233,6 +235,7 @@ draw_underline (PangoRenderer *renderer,
                                     rect->height);
       break;
     case PANGO_UNDERLINE_ERROR:
+    case PANGO_UNDERLINE_ERROR_LINE:
       pango_renderer_draw_error_underline (renderer,
                                           rect->x,
                                           rect->y,
@@ -326,6 +329,18 @@ add_underline (PangoRenderer    *renderer,
     case PANGO_UNDERLINE_LOW:
       new_rect.y += ink_rect->y + ink_rect->height + underline_thickness;
       break;
+    case PANGO_UNDERLINE_SINGLE_LINE:
+    case PANGO_UNDERLINE_DOUBLE_LINE:
+    case PANGO_UNDERLINE_ERROR_LINE:
+      new_rect.y -= underline_position;
+      if (state->underline == renderer->underline)
+        {
+          new_rect.y = MAX (current_rect->y, new_rect.y);
+          new_rect.height = MAX (current_rect->height, new_rect.height);
+          current_rect->y = new_rect.y;
+          current_rect->height = new_rect.height;
+        }
+      break;
     }
 
   if (renderer->underline == state->underline &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]