[pango/redo-attrs: 16/25] Drop some underline variants




commit 7d656b030db6cb9767cd862c8c115e935f0a2ad5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 6 23:52:09 2022 -0500

    Drop some underline variants
    
    Make them always behave like _LINE.

 pango/pango-attr-list.c  |  2 +-
 pango/pango-attributes.h | 14 +-------------
 pango/pango-layout.c     |  3 ---
 pango/pango-renderer.c   | 14 +++-----------
 pango/serializer.c       |  3 ---
 tests/testattributes.c   |  4 ++--
 6 files changed, 7 insertions(+), 33 deletions(-)
---
diff --git a/pango/pango-attr-list.c b/pango/pango-attr-list.c
index 88e5921d..07e98b68 100644
--- a/pango/pango-attr-list.c
+++ b/pango/pango-attr-list.c
@@ -1135,7 +1135,7 @@ pango_attr_list_from_string (const char *text)
           break;
 
         case PANGO_ATTR_UNDERLINE:
-          ENUM_ATTR(underline, PangoUnderline, PANGO_UNDERLINE_NONE, PANGO_UNDERLINE_ERROR_LINE);
+          ENUM_ATTR(underline, PangoUnderline, PANGO_UNDERLINE_NONE, PANGO_UNDERLINE_ERROR);
           break;
 
         case PANGO_ATTR_STRIKETHROUGH:
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index c7e9287a..0a35bebb 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -160,15 +160,6 @@ PangoAttribute *        pango_attr_font_desc_new                (const PangoFont
  *   as a possible mispelling; in some cases a contrasting color
  *   may automatically be used. This type of underlining is
  *   available since Pango 1.4.
- * @PANGO_UNDERLINE_SINGLE_LINE: Like @PANGO_UNDERLINE_SINGLE, but
- *   drawn continuously across multiple runs. This type
- *   of underlining is available since Pango 1.46.
- * @PANGO_UNDERLINE_DOUBLE_LINE: Like @PANGO_UNDERLINE_DOUBLE, but
- *   drawn continuously across multiple runs. This type
- *   of underlining is available since Pango 1.46.
- * @PANGO_UNDERLINE_ERROR_LINE: Like @PANGO_UNDERLINE_ERROR, but
- *   drawn continuously across multiple runs. This type
- *   of underlining is available since Pango 1.46.
  *
  * The `PangoUnderline` enumeration is used to specify whether text
  * should be underlined, and if so, the type of underlining.
@@ -178,10 +169,7 @@ typedef enum {
   PANGO_UNDERLINE_SINGLE,
   PANGO_UNDERLINE_DOUBLE,
   PANGO_UNDERLINE_LOW,
-  PANGO_UNDERLINE_ERROR,
-  PANGO_UNDERLINE_SINGLE_LINE,
-  PANGO_UNDERLINE_DOUBLE_LINE,
-  PANGO_UNDERLINE_ERROR_LINE
+  PANGO_UNDERLINE_ERROR
 } PangoUnderline;
 
 PANGO_AVAILABLE_IN_ALL
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 2a92dbda..e09b6309 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -6749,18 +6749,15 @@ pango_layout_get_item_properties (PangoItem      *item,
             case PANGO_UNDERLINE_NONE:
               break;
             case PANGO_UNDERLINE_SINGLE:
-            case PANGO_UNDERLINE_SINGLE_LINE:
               properties->uline_single = TRUE;
               break;
             case PANGO_UNDERLINE_DOUBLE:
-            case PANGO_UNDERLINE_DOUBLE_LINE:
               properties->uline_double = TRUE;
               break;
             case PANGO_UNDERLINE_LOW:
               properties->uline_low = TRUE;
               break;
             case PANGO_UNDERLINE_ERROR:
-            case PANGO_UNDERLINE_ERROR_LINE:
               properties->uline_error = TRUE;
               break;
             default:
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index da052874..687e678c 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -224,7 +224,6 @@ 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,
@@ -234,7 +233,6 @@ draw_underline (PangoRenderer *renderer,
       G_GNUC_FALLTHROUGH;
     case PANGO_UNDERLINE_SINGLE:
     case PANGO_UNDERLINE_LOW:
-    case PANGO_UNDERLINE_SINGLE_LINE:
       pango_renderer_draw_rectangle (renderer,
                                      PANGO_RENDER_PART_UNDERLINE,
                                      rect->x,
@@ -243,7 +241,6 @@ 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,
@@ -372,17 +369,12 @@ add_underline (PangoRenderer    *renderer,
     case PANGO_UNDERLINE_NONE:
       g_assert_not_reached ();
       break;
-    case PANGO_UNDERLINE_SINGLE:
-    case PANGO_UNDERLINE_DOUBLE:
-    case PANGO_UNDERLINE_ERROR:
-      new_rect.y -= underline_position;
-      break;
     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:
+    case PANGO_UNDERLINE_SINGLE:
+    case PANGO_UNDERLINE_DOUBLE:
+    case PANGO_UNDERLINE_ERROR:
       new_rect.y -= underline_position;
       if (state->underline == renderer->underline)
         {
diff --git a/pango/serializer.c b/pango/serializer.c
index 19a3bb2c..3b0e3dd5 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -78,9 +78,6 @@ static const char *underline_names[] = {
   "double",
   "low",
   "error",
-  "single-line",
-  "double-line",
-  "error-line",
   NULL
 };
 
diff --git a/tests/testattributes.c b/tests/testattributes.c
index ba2ec180..a066422c 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -51,7 +51,7 @@ test_attributes_basic (void)
   test_copy (pango_attr_font_desc_new (desc));
   pango_font_description_free (desc);
   test_copy (pango_attr_underline_new (PANGO_UNDERLINE_LOW));
-  test_copy (pango_attr_underline_new (PANGO_UNDERLINE_ERROR_LINE));
+  test_copy (pango_attr_underline_new (PANGO_UNDERLINE_ERROR));
   test_copy (pango_attr_underline_color_new (&(PangoColor){100, 200, 300}));
   test_copy (pango_attr_overline_new (PANGO_OVERLINE_SINGLE));
   test_copy (pango_attr_overline_color_new (&(PangoColor){100, 200, 300}));
@@ -231,7 +231,7 @@ test_binding_helpers (void)
   test_binding (pango_attr_font_desc_new (desc));
   pango_font_description_free (desc);
   test_binding (pango_attr_underline_new (PANGO_UNDERLINE_LOW));
-  test_binding (pango_attr_underline_new (PANGO_UNDERLINE_ERROR_LINE));
+  test_binding (pango_attr_underline_new (PANGO_UNDERLINE_ERROR));
   test_binding (pango_attr_underline_color_new (&(PangoColor){100, 200, 300}));
   test_binding (pango_attr_overline_new (PANGO_OVERLINE_SINGLE));
   test_binding (pango_attr_overline_color_new (&(PangoColor){100, 200, 300}));


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