[pango/pango2: 135/135] Add alpha to PangoColor




commit 36ef890bb016b517dd4b27c776d81bdf8230e3e5
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Feb 8 14:08:25 2022 -0500

    Add alpha to PangoColor
    
    Adapt all users. This drops the alpha attributes
    and alpha in markup, and adds alpha support to
    underlines, overlines and strikethroughs.

 docs/pango_markup.md            |  18 +------
 pango/pango-attr-list.c         |   8 ---
 pango/pango-attr.c              |   2 -
 pango/pango-attributes.c        |  36 -------------
 pango/pango-attributes.h        |   4 --
 pango/pango-color.c             |  72 +++++++++++--------------
 pango/pango-color.h             |  14 ++---
 pango/pango-markup.c            |  95 +++------------------------------
 pango/pango-renderer.c          |  79 +---------------------------
 pango/pango-renderer.h          |   8 ---
 pango/pangocairo-render.c       |   8 +--
 pango/serializer.c              |   8 ---
 tests/markups/fail-10.markup    |   2 +-
 tests/markups/fail-12.expected  |   1 -
 tests/markups/fail-12.markup    |   1 -
 tests/markups/fail-25.expected  |   1 -
 tests/markups/fail-25.markup    |   1 -
 tests/markups/fail-26.expected  |   1 -
 tests/markups/fail-26.markup    |   1 -
 tests/markups/fail-27.expected  |   2 +-
 tests/markups/fail-27.markup    |   2 +-
 tests/markups/fail-28.expected  |   2 +-
 tests/markups/fail-28.markup    |   2 +-
 tests/markups/fail-4.expected   |   2 +-
 tests/markups/fail-4.markup     |   2 +-
 tests/markups/fail-9.expected   |   2 +-
 tests/markups/valid-1.expected  |   2 +-
 tests/markups/valid-10.expected |  25 +--------
 tests/markups/valid-11.expected |  30 +++++------
 tests/markups/valid-11.markup   |   2 +-
 tests/markups/valid-12.expected |   8 +--
 tests/markups/valid-12.markup   |   6 +--
 tests/markups/valid-13.expected |   3 +-
 tests/markups/valid-14.expected |   6 ++-
 tests/markups/valid-18.expected |  10 ++--
 tests/markups/valid-18.markup   |   2 +-
 tests/markups/valid-19.expected |   2 +-
 tests/markups/valid-2.expected  |   2 +-
 tests/markups/valid-3.expected  |  10 ++--
 tests/markups/valid-3.markup    |   2 +-
 tests/markups/valid-4.expected  |  10 ++--
 tests/markups/valid-5.expected  |   8 +--
 tests/markups/valid-6.expected  |  11 ++--
 tests/markups/valid-7.expected  |   4 +-
 tests/markups/valid-8.expected  |  18 +++----
 tests/markups/valid-8.markup    |  10 ++--
 tests/testattributes.c          |   4 --
 tests/testcolor.c               | 114 ++++++++++++++++------------------------
 tests/testserialize.c           |  10 ++--
 49 files changed, 179 insertions(+), 494 deletions(-)
---
diff --git a/docs/pango_markup.md b/docs/pango_markup.md
index 6a6cc3c2..2376dd8a 100644
--- a/docs/pango_markup.md
+++ b/docs/pango_markup.md
@@ -115,25 +115,11 @@ font_features
 foreground
 fgcolor
 color
-: An RGB color specification such as '#00FF00' or a color name such as 'red'.
-  Since 1.38, an RGBA color specification such as '#00FF007F' will be interpreted
-  as specifying both a foreground color and foreground alpha.
+: An RGBA color specification such as '#00FF007F' or a color name such as 'red'.
 
 background
 bgcolor
-: An RGB color specification such as '#00FF00' or a color name such as 'red'.
-  Since 1.38, an RGBA color specification such as '#00FF007F' will be interpreted
-  as specifying both a background color and background alpha.
-
-alpha
-fgalpha
-: An alpha value for the foreground color, either a plain integer between 1 and
-  65536 or a percentage value like '50%'.
-
-background_alpha
-bgalpha
-: An alpha value for the background color, either a plain integer between 1 and
-  65536 or a percentage value like '50%'.
+: An RGBA color specification such as '#00FF007F' or a color name such as 'red'.
 
 underline
 : One of 'none', 'single', 'double', 'low', 'error'.
diff --git a/pango/pango-attr-list.c b/pango/pango-attr-list.c
index f6470e2c..3f920091 100644
--- a/pango/pango-attr-list.c
+++ b/pango/pango-attr-list.c
@@ -1196,14 +1196,6 @@ pango_attr_list_from_string (const char *text)
           ENUM_ATTR(gravity_hint, PangoGravityHint, PANGO_GRAVITY_HINT_NATURAL, PANGO_GRAVITY_HINT_LINE);
           break;
 
-        case PANGO_ATTR_FOREGROUND_ALPHA:
-          INT_ATTR(foreground_alpha, int);
-          break;
-
-        case PANGO_ATTR_BACKGROUND_ALPHA:
-          INT_ATTR(background_alpha, int);
-          break;
-
         case PANGO_ATTR_ALLOW_BREAKS:
           BOOLEAN_ATTR(allow_breaks, gboolean);
           break;
diff --git a/pango/pango-attr.c b/pango/pango-attr.c
index 5794e7c7..cc8f7101 100644
--- a/pango/pango-attr.c
+++ b/pango/pango-attr.c
@@ -86,8 +86,6 @@ is_valid_attr_type (guint type)
     case PANGO_ATTR_GRAVITY:
     case PANGO_ATTR_GRAVITY_HINT:
     case PANGO_ATTR_FONT_FEATURES:
-    case PANGO_ATTR_FOREGROUND_ALPHA:
-    case PANGO_ATTR_BACKGROUND_ALPHA:
     case PANGO_ATTR_ALLOW_BREAKS:
     case PANGO_ATTR_SHOW:
     case PANGO_ATTR_INSERT_HYPHENS:
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 6ab9682a..4d5973d5 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -593,42 +593,6 @@ pango_attr_font_features_new (const char *features)
   return pango_attr_string_new (PANGO_ATTR_FONT_FEATURES, features);
 }
 
-/**
- * pango_attr_foreground_alpha_new:
- * @alpha: the alpha value, between 1 and 65536
- *
- * Create a new foreground alpha attribute.
- *
- * Return value: (transfer full): the newly allocated
- *   `PangoAttribute`, which should be freed with
- *   [method@Pango.Attribute.destroy]
- *
- * Since: 1.38
- */
-PangoAttribute *
-pango_attr_foreground_alpha_new (guint16 alpha)
-{
-  return pango_attr_int_new (PANGO_ATTR_FOREGROUND_ALPHA, (int)alpha);
-}
-
-/**
- * pango_attr_background_alpha_new:
- * @alpha: the alpha value, between 1 and 65536
- *
- * Create a new background alpha attribute.
- *
- * Return value: (transfer full): the newly allocated
- *   `PangoAttribute`, which should be freed with
- *   [method@Pango.Attribute.destroy]
- *
- * Since: 1.38
- */
-PangoAttribute *
-pango_attr_background_alpha_new (guint16 alpha)
-{
-  return pango_attr_int_new (PANGO_ATTR_BACKGROUND_ALPHA, (int)alpha);
-}
-
 /**
  * pango_attr_allow_breaks_new:
  * @allow_breaks: %TRUE if we line breaks are allowed
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 929a784e..822ec6b3 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -244,10 +244,6 @@ PANGO_AVAILABLE_IN_1_16
 PangoAttribute *        pango_attr_gravity_hint_new             (PangoGravityHint             hint);
 PANGO_AVAILABLE_IN_1_38
 PangoAttribute *        pango_attr_font_features_new            (const char                  *features);
-PANGO_AVAILABLE_IN_1_38
-PangoAttribute *        pango_attr_foreground_alpha_new         (guint16                      alpha);
-PANGO_AVAILABLE_IN_1_38
-PangoAttribute *        pango_attr_background_alpha_new         (guint16                      alpha);
 PANGO_AVAILABLE_IN_1_44
 PangoAttribute *        pango_attr_allow_breaks_new             (gboolean                     allow_breaks);
 PANGO_AVAILABLE_IN_1_50
diff --git a/pango/pango-color.c b/pango/pango-color.c
index 7e7c4a24..a5a8a141 100644
--- a/pango/pango-color.c
+++ b/pango/pango-color.c
@@ -76,15 +76,36 @@ pango_color_free (PangoColor *color)
   g_slice_free (PangoColor, color);
 }
 
+/**
+ * pango_color_equal:
+ * @color1: (nullable): a `PangoColor`
+ * @color2: (nullable): another `PangoColor`
+ *
+ * Compares two colors for quality.
+ *
+ * Returns: `TRUE` if the colors are equal
+ */
+gboolean
+pango_color_equal (const PangoColor *color1,
+                   const PangoColor *color2)
+{
+  return color1 == color2 ||
+         (color1 && color2 &&
+          color1->red == color2->red &&
+          color1->green == color2->green &&
+          color1->blue == color2->blue &&
+          color1->alpha == color2->alpha);
+}
+
 /**
  * pango_color_to_string:
  * @color: a `PangoColor`
  *
  * Returns a textual specification of @color.
  *
- * The string is in the hexadecimal form `#rrrrggggbbbb`,
- * where `r`, `g` and `b` are hex digits representing the
- * red, green, and blue components respectively.
+ * The string is in the hexadecimal form `#rrrrggggbbbbaaaa`,
+ * where `r`, `g`, `b` and `a` are hex digits representing the
+ * red, green, blue and alpha components respectively.
  *
  * Return value: a newly-allocated text string that must
  *   be freed with g_free().
@@ -96,7 +117,7 @@ pango_color_to_string (const PangoColor *color)
 {
   g_return_val_if_fail (color != NULL, NULL);
 
-  return g_strdup_printf ("#%04x%04x%04x", color->red, color->green, color->blue);
+  return g_strdup_printf ("#%04x%04x%04x%04x", color->red, color->green, color->blue, color->alpha);
 }
 
 /* Color parsing
@@ -211,10 +232,9 @@ hex (const char *spec,
 
 
 /**
- * pango_color_parse_with_alpha:
+ * pango_color_parse:
  * @color: (nullable): a `PangoColor` structure in which
  *   to store the result
- * @alpha: (out) (optional): return location for alpha
  * @spec: a string specifying the new color
  *
  * Fill in the fields of a color from a string specification.
@@ -239,14 +259,12 @@ hex (const char *spec,
  * Since: 1.46
  */
 gboolean
-pango_color_parse_with_alpha (PangoColor *color,
-                              guint16    *alpha,
-                              const char *spec)
+pango_color_parse (PangoColor *color,
+                   const char *spec)
 {
   g_return_val_if_fail (spec != NULL, FALSE);
 
-  if (alpha)
-    *alpha = 0xffff;
+  color->alpha = 0xffff;
 
   if (spec[0] == '#')
     {
@@ -268,8 +286,6 @@ pango_color_parse_with_alpha (PangoColor *color,
         case 4:
         case 8:
         case 16:
-          if (!alpha)
-            return FALSE;
           len /= 4;
           has_alpha = TRUE;
           break;
@@ -301,7 +317,7 @@ pango_color_parse_with_alpha (PangoColor *color,
           color->blue  = b;
         }
 
-      if (alpha && has_alpha)
+      if (has_alpha)
         {
           int bits = len * 4;
           a <<= 16 - bits;
@@ -310,7 +326,7 @@ pango_color_parse_with_alpha (PangoColor *color,
               a |= (a >> bits);
               bits *= 2;
             }
-          *alpha = a;
+          color->alpha = a;
         }
     }
   else
@@ -320,29 +336,3 @@ pango_color_parse_with_alpha (PangoColor *color,
     }
   return TRUE;
 }
-
-/**
- * pango_color_parse:
- * @color: (nullable): a `PangoColor` structure in which
- *   to store the result
- * @spec: a string specifying the new color
- *
- * Fill in the fields of a color from a string specification.
- *
- * The string can either one of a large set of standard names.
- * (Taken from the CSS Color [specification](https://www.w3.org/TR/css-color-4/#named-colors),
- * or it can be a value in the form `#rgb`, `#rrggbb`,
- * `#rrrgggbbb` or `#rrrrggggbbbb`, where `r`, `g` and `b`
- * are hex digits of the red, green, and blue components
- * of the color, respectively. (White in the four forms is
- * `#fff`, `#ffffff`, `#fffffffff` and `#ffffffffffff`.)
- *
- * Return value: %TRUE if parsing of the specifier succeeded,
- *   otherwise %FALSE
- */
-gboolean
-pango_color_parse (PangoColor *color,
-                   const char *spec)
-{
-  return pango_color_parse_with_alpha (color, NULL, spec);
-}
diff --git a/pango/pango-color.h b/pango/pango-color.h
index 675d8e82..cedcddaf 100644
--- a/pango/pango-color.h
+++ b/pango/pango-color.h
@@ -35,15 +35,18 @@ typedef struct _PangoColor PangoColor;
  * @red: value of red component
  * @green: value of green component
  * @blue: value of blue component
+ * @alpha: value of the alpha component
  *
  * The `PangoColor` structure is used to
- * represent a color in an uncalibrated RGB color-space.
+ * represent a color in an uncalibrated RGB color-space
+ * with alpha.
  */
 struct _PangoColor
 {
   guint16 red;
   guint16 green;
   guint16 blue;
+  guint16 alpha;
 };
 
 #define PANGO_TYPE_COLOR (pango_color_get_type ())
@@ -58,12 +61,11 @@ PANGO_AVAILABLE_IN_ALL
 void        pango_color_free             (PangoColor       *color);
 
 PANGO_AVAILABLE_IN_ALL
-gboolean    pango_color_parse            (PangoColor       *color,
-                                          const char       *spec);
+gboolean    pango_color_equal            (const PangoColor *color1,
+                                          const PangoColor *color2);
 
-PANGO_AVAILABLE_IN_1_46
-gboolean    pango_color_parse_with_alpha (PangoColor       *color,
-                                          guint16          *alpha,
+PANGO_AVAILABLE_IN_ALL
+gboolean    pango_color_parse            (PangoColor       *color,
                                           const char       *spec);
 
 PANGO_AVAILABLE_IN_1_16
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index f8fa495a..98d19e33 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -1047,11 +1047,10 @@ static gboolean
 span_parse_color (const char *attr_name,
                  const char *attr_val,
                  PangoColor *color,
-                  guint16 *alpha,
                  int line_number,
                  GError **error)
 {
-  if (!pango_color_parse_with_alpha (color, alpha, attr_val))
+  if (!pango_color_parse (color, attr_val))
     {
       g_set_error (error,
                   G_MARKUP_ERROR,
@@ -1066,56 +1065,6 @@ span_parse_color (const char *attr_name,
   return TRUE;
 }
 
-static gboolean
-span_parse_alpha (const char  *attr_name,
-                  const char  *attr_val,
-                  guint16     *val,
-                  int          line_number,
-                  GError     **error)
-{
-  const char *end = attr_val;
-  int int_val;
-
-  if (_pango_scan_int (&end, &int_val))
-    {
-      if (*end == '\0' && int_val > 0 && int_val <= 0xffff)
-        {
-          *val = (guint16)int_val;
-          return TRUE;
-        }
-      else if (*end == '%' && int_val > 0 && int_val <= 100)
-        {
-          *val = (guint16)(int_val * 0xffff / 100);
-          return TRUE;
-        }
-      else
-        {
-          g_set_error (error,
-                       G_MARKUP_ERROR,
-                       G_MARKUP_ERROR_INVALID_CONTENT,
-                       _("Value of '%s' attribute on <span> tag "
-                         "on line %d could not be parsed; "
-                         "should be between 0 and 65536 or a "
-                         "percentage, not '%s'"),
-                         attr_name, line_number, attr_val);
-          return FALSE;
-        }
-    }
-  else
-    {
-      g_set_error (error,
-                  G_MARKUP_ERROR,
-                  G_MARKUP_ERROR_INVALID_CONTENT,
-                  _("Value of '%s' attribute on <span> tag "
-                    "on line %d could not be parsed; "
-                    "should be an integer, not '%s'"),
-                  attr_name, line_number, attr_val);
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
 static gboolean
 span_parse_enum (const char *attr_name,
                 const char *attr_val,
@@ -1232,8 +1181,6 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
   const char *gravity = NULL;
   const char *gravity_hint = NULL;
   const char *font_features = NULL;
-  const char *alpha = NULL;
-  const char *background_alpha = NULL;
   const char *allow_breaks = NULL;
   const char *insert_hyphens = NULL;
   const char *show = NULL;
@@ -1271,13 +1218,10 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
       switch (names[i][0]) {
       case 'a':
         CHECK_ATTRIBUTE (allow_breaks);
-        CHECK_ATTRIBUTE (alpha);
         break;
       case 'b':
        CHECK_ATTRIBUTE (background);
        CHECK_ATTRIBUTE2(background, "bgcolor");
-        CHECK_ATTRIBUTE (background_alpha);
-        CHECK_ATTRIBUTE2(background_alpha, "bgalpha");
         CHECK_ATTRIBUTE(baseline_shift);
         break;
       case 'c':
@@ -1299,7 +1243,6 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
 
        CHECK_ATTRIBUTE (foreground);
        CHECK_ATTRIBUTE2(foreground, "fgcolor");
-       CHECK_ATTRIBUTE2(alpha, "fgalpha");
 
        CHECK_ATTRIBUTE (font_features);
        break;
@@ -1503,47 +1446,21 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
   if (G_UNLIKELY (foreground))
     {
       PangoColor color;
-      guint16 alpha;
 
-      if (!span_parse_color ("foreground", foreground, &color, &alpha, line_number, error))
+      if (!span_parse_color ("foreground", foreground, &color, line_number, error))
        goto error;
 
       add_attribute (tag, pango_attr_foreground_new (&color));
-      if (alpha != 0xffff)
-        add_attribute (tag, pango_attr_foreground_alpha_new (alpha));
     }
 
   if (G_UNLIKELY (background))
     {
       PangoColor color;
-      guint16 alpha;
 
-      if (!span_parse_color ("background", background, &color, &alpha, line_number, error))
+      if (!span_parse_color ("background", background, &color, line_number, error))
        goto error;
 
       add_attribute (tag, pango_attr_background_new (&color));
-      if (alpha != 0xffff)
-        add_attribute (tag, pango_attr_background_alpha_new (alpha));
-    }
-
-  if (G_UNLIKELY (alpha))
-    {
-      guint16 val;
-
-      if (!span_parse_alpha ("alpha", alpha, &val, line_number, error))
-        goto error;
-
-      add_attribute (tag, pango_attr_foreground_alpha_new (val));
-    }
-
-  if (G_UNLIKELY (background_alpha))
-    {
-      guint16 val;
-
-      if (!span_parse_alpha ("background_alpha", background_alpha, &val, line_number, error))
-        goto error;
-
-      add_attribute (tag, pango_attr_background_alpha_new (val));
     }
 
   if (G_UNLIKELY (underline))
@@ -1570,7 +1487,7 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
     {
       PangoColor color;
 
-      if (!span_parse_color ("underline_color", underline_color, &color, NULL, line_number, error))
+      if (!span_parse_color ("underline_color", underline_color, &color, line_number, error))
        goto error;
 
       add_attribute (tag, pango_attr_underline_color_new (&color));
@@ -1590,7 +1507,7 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
     {
       PangoColor color;
 
-      if (!span_parse_color ("overline_color", overline_color, &color, NULL, line_number, error))
+      if (!span_parse_color ("overline_color", overline_color, &color, line_number, error))
        goto error;
 
       add_attribute (tag, pango_attr_overline_color_new (&color));
@@ -1643,7 +1560,7 @@ span_parse_func     (MarkupData            *md G_GNUC_UNUSED,
     {
       PangoColor color;
 
-      if (!span_parse_color ("strikethrough_color", strikethrough_color, &color, NULL, line_number, error))
+      if (!span_parse_color ("strikethrough_color", strikethrough_color, &color, line_number, error))
        goto error;
 
       add_attribute (tag, pango_attr_strikethrough_color_new (&color));
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 38fe2ebe..fd5e67d0 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -63,7 +63,6 @@ struct _PangoRendererPrivate
 
   PangoColor color[N_RENDER_PARTS];
   gboolean color_set[N_RENDER_PARTS];
-  guint16 alpha[N_RENDER_PARTS];
 
   PangoLines *lines;
   PangoLine *line;
@@ -1242,8 +1241,6 @@ pango_renderer_deactivate (PangoRenderer *renderer)
  *
  * Sets the color for part of the rendering.
  *
- * Also see [method@Pango.Renderer.set_alpha].
- *
  * Since: 1.8
  */
 void
@@ -1254,11 +1251,9 @@ pango_renderer_set_color (PangoRenderer    *renderer,
   g_return_if_fail (PANGO_IS_RENDERER_FAST (renderer));
   g_return_if_fail (IS_VALID_PART (part));
 
-  if ((!color && !renderer->priv->color_set[part]) ||
+  if (!color && !renderer->priv->color_set[part] ||
       (color && renderer->priv->color_set[part] &&
-       renderer->priv->color[part].red == color->red &&
-       renderer->priv->color[part].green == color->green &&
-       renderer->priv->color[part].blue == color->blue))
+       pango_color_equal (color, &renderer->priv->color[part])))
     return;
 
   pango_renderer_part_changed (renderer, part);
@@ -1300,60 +1295,6 @@ pango_renderer_get_color (PangoRenderer   *renderer,
     return NULL;
 }
 
-/**
- * pango_renderer_set_alpha:
- * @renderer: a `PangoRenderer`
- * @part: the part to set the alpha for
- * @alpha: an alpha value between 1 and 65536, or 0 to unset the alpha
- *
- * Sets the alpha for part of the rendering.
- *
- * Note that the alpha may only be used if a color is
- * specified for @part as well.
- *
- * Since: 1.38
- */
-void
-pango_renderer_set_alpha (PangoRenderer   *renderer,
-                          PangoRenderPart  part,
-                          guint16          alpha)
-{
-  g_return_if_fail (PANGO_IS_RENDERER_FAST (renderer));
-  g_return_if_fail (IS_VALID_PART (part));
-
-  if ((!alpha && !renderer->priv->alpha[part]) ||
-      (alpha && renderer->priv->alpha[part] &&
-       renderer->priv->alpha[part] == alpha))
-    return;
-
-  pango_renderer_part_changed (renderer, part);
-
-  renderer->priv->alpha[part] = alpha;
-}
-
-/**
- * pango_renderer_get_alpha:
- * @renderer: a `PangoRenderer`
- * @part: the part to get the alpha for
- *
- * Gets the current alpha for the specified part.
- *
- * Return value: the alpha for the specified part,
- *   or 0 if it hasn't been set and should be
- *   inherited from the environment.
- *
- * Since: 1.38
- */
-guint16
-pango_renderer_get_alpha (PangoRenderer   *renderer,
-                          PangoRenderPart  part)
-{
-  g_return_val_if_fail (PANGO_IS_RENDERER_FAST (renderer), 0);
-  g_return_val_if_fail (IS_VALID_PART (part), 0);
-
-  return renderer->priv->alpha[part];
-}
-
 /**
  * pango_renderer_part_changed:
  * @renderer: a `PangoRenderer`
@@ -1418,8 +1359,6 @@ pango_renderer_default_prepare_run (PangoRenderer  *renderer,
   PangoColor *underline_color = NULL;
   PangoColor *overline_color = NULL;
   PangoColor *strikethrough_color = NULL;
-  guint16 fg_alpha = 0;
-  guint16 bg_alpha = 0;
   GSList *l;
   PangoGlyphItem *glyph_item;
 
@@ -1472,14 +1411,6 @@ pango_renderer_default_prepare_run (PangoRenderer  *renderer,
           strikethrough_color = &attr->color_value;
           break;
 
-        case PANGO_ATTR_FOREGROUND_ALPHA:
-          fg_alpha = attr->int_value;
-          break;
-
-        case PANGO_ATTR_BACKGROUND_ALPHA:
-          bg_alpha = attr->int_value;
-          break;
-
         default:
           break;
         }
@@ -1499,12 +1430,6 @@ pango_renderer_default_prepare_run (PangoRenderer  *renderer,
   pango_renderer_set_color (renderer, PANGO_RENDER_PART_UNDERLINE, underline_color);
   pango_renderer_set_color (renderer, PANGO_RENDER_PART_STRIKETHROUGH, strikethrough_color);
   pango_renderer_set_color (renderer, PANGO_RENDER_PART_OVERLINE, overline_color);
-
-  pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_FOREGROUND, fg_alpha);
-  pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_BACKGROUND, bg_alpha);
-  pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_UNDERLINE, fg_alpha);
-  pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_STRIKETHROUGH, fg_alpha);
-  pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_OVERLINE, fg_alpha);
 }
 
 /**
diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h
index 1ed576d5..0571f0a8 100644
--- a/pango/pango-renderer.h
+++ b/pango/pango-renderer.h
@@ -267,14 +267,6 @@ PANGO_AVAILABLE_IN_1_8
 PangoColor *pango_renderer_get_color     (PangoRenderer    *renderer,
                                           PangoRenderPart   part);
 
-PANGO_AVAILABLE_IN_1_38
-void        pango_renderer_set_alpha     (PangoRenderer    *renderer,
-                                          PangoRenderPart   part,
-                                          guint16           alpha);
-PANGO_AVAILABLE_IN_1_38
-guint16     pango_renderer_get_alpha     (PangoRenderer    *renderer,
-                                          PangoRenderPart   part);
-
 PANGO_AVAILABLE_IN_1_8
 void               pango_renderer_set_matrix      (PangoRenderer     *renderer,
                                                    const PangoMatrix *matrix);
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 504b8ba3..0f32d905 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -61,10 +61,9 @@ set_color (PangoCairoRenderer *crenderer,
           PangoRenderPart     part)
 {
   PangoColor *color = pango_renderer_get_color ((PangoRenderer *) (crenderer), part);
-  guint16 a = pango_renderer_get_alpha ((PangoRenderer *) (crenderer), part);
   gdouble red, green, blue, alpha;
 
-  if (!a && !color)
+  if (!color)
     return;
 
   if (color)
@@ -72,7 +71,7 @@ set_color (PangoCairoRenderer *crenderer,
       red = color->red / 65535.;
       green = color->green / 65535.;
       blue = color->blue / 65535.;
-      alpha = 1.;
+      alpha = color->alpha / 65535.;
     }
   else
     {
@@ -89,9 +88,6 @@ set_color (PangoCairoRenderer *crenderer,
         }
     }
 
-  if (a)
-    alpha = a / 65535.;
-
   cairo_set_source_rgba (crenderer->cr, red, green, blue, alpha);
 }
 
diff --git a/pango/serializer.c b/pango/serializer.c
index f1a15212..86507be7 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -1072,14 +1072,6 @@ attr_for_type (GtkJsonParser *parser,
       g_free (str);
       break;
 
-    case PANGO_ATTR_FOREGROUND_ALPHA:
-      attr = pango_attr_foreground_alpha_new ((int) gtk_json_parser_get_number (parser));
-      break;
-
-    case PANGO_ATTR_BACKGROUND_ALPHA:
-      attr = pango_attr_background_alpha_new ((int) gtk_json_parser_get_number (parser));
-      break;
-
     case PANGO_ATTR_ALLOW_BREAKS:
       attr = pango_attr_allow_breaks_new (gtk_json_parser_get_boolean (parser));
       break;
diff --git a/tests/markups/fail-10.markup b/tests/markups/fail-10.markup
index 692f49a9..80edbc9d 100644
--- a/tests/markups/fail-10.markup
+++ b/tests/markups/fail-10.markup
@@ -3,7 +3,7 @@
       background="#f0f0f0"
       underline="double"
       underline_color="red"
-      strikethrough="true"
+      strikethrough="single"
       strikethrough_color="blue"
       fallback="x"
       lang="de"
diff --git a/tests/markups/fail-27.expected b/tests/markups/fail-27.expected
index 0f3610ba..d602bee2 100644
--- a/tests/markups/fail-27.expected
+++ b/tests/markups/fail-27.expected
@@ -1 +1 @@
-ERROR: 'dotted' is not a valid value for the 'underline' attribute on <span> tag, line 1; valid values are 
none/single/double/low/error/single-line/double-line/error-line
\ No newline at end of file
+ERROR: 'triple' is not a valid value for the 'underline' attribute on <span> tag, line 1; valid values are 
none/single/double/dashed/dotted/wavy
\ No newline at end of file
diff --git a/tests/markups/fail-27.markup b/tests/markups/fail-27.markup
index 33f0389c..e1dd894a 100644
--- a/tests/markups/fail-27.markup
+++ b/tests/markups/fail-27.markup
@@ -1 +1 @@
-<span underline="dotted">test</span>
+<span underline="triple">test</span>
diff --git a/tests/markups/fail-28.expected b/tests/markups/fail-28.expected
index c0184743..b9f870e7 100644
--- a/tests/markups/fail-28.expected
+++ b/tests/markups/fail-28.expected
@@ -1 +1 @@
-ERROR: 'dotted' is not a valid value for the 'overline' attribute on <span> tag, line 1; valid values are 
none/single
\ No newline at end of file
+ERROR: 'triple' is not a valid value for the 'overline' attribute on <span> tag, line 1; valid values are 
none/single/double/dashed/dotted/wavy
\ No newline at end of file
diff --git a/tests/markups/fail-28.markup b/tests/markups/fail-28.markup
index be7e28ed..333aee3d 100644
--- a/tests/markups/fail-28.markup
+++ b/tests/markups/fail-28.markup
@@ -1 +1 @@
-<span overline="dotted">test</span>
+<span overline="triple">test</span>
diff --git a/tests/markups/fail-4.expected b/tests/markups/fail-4.expected
index b3e31c78..a1dab3ea 100644
--- a/tests/markups/fail-4.expected
+++ b/tests/markups/fail-4.expected
@@ -1 +1 @@
-ERROR: Value of 'underline_color' attribute on <span> tag on line 1 could not be parsed; should be a color 
specification, not '#2345'
\ No newline at end of file
+ERROR: Value of 'underline_color' attribute on <span> tag on line 1 could not be parsed; should be a color 
specification, not '#234g'
\ No newline at end of file
diff --git a/tests/markups/fail-4.markup b/tests/markups/fail-4.markup
index ab9fc03c..4efac8a8 100644
--- a/tests/markups/fail-4.markup
+++ b/tests/markups/fail-4.markup
@@ -1 +1 @@
-<span underline_color="#2345">Text</span>
+<span underline_color="#234g">Text</span>
diff --git a/tests/markups/fail-9.expected b/tests/markups/fail-9.expected
index a81ca513..d256f059 100644
--- a/tests/markups/fail-9.expected
+++ b/tests/markups/fail-9.expected
@@ -1 +1 @@
-ERROR: Value of 'strikethrough' attribute on <span> tag line 11 should have one of 'true/yes/t/y' or 
'false/no/f/n': 'x' is not valid
\ No newline at end of file
+ERROR: 'x' is not a valid value for the 'strikethrough' attribute on <span> tag, line 11; valid values are 
none/single/double/dashed/dotted/wavy
\ No newline at end of file
diff --git a/tests/markups/valid-1.expected b/tests/markups/valid-1.expected
index 92e23837..6b86feb1 100644
--- a/tests/markups/valid-1.expected
+++ b/tests/markups/valid-1.expected
@@ -5,7 +5,7 @@ Blue text is cool!
 
 range 0 9
 0 9 scale 1.440000
-0 9 foreground #00000000ffff
+0 9 foreground #00000000ffffffff
 range 9 13
 range 13 17
 13 17 style italic
diff --git a/tests/markups/valid-10.expected b/tests/markups/valid-10.expected
index 24f3f8e3..4c723acd 100644
--- a/tests/markups/valid-10.expected
+++ b/tests/markups/valid-10.expected
@@ -1,24 +1 @@
-Lots of attrs
-
-
----
-
-range 0 13
-0 13 font-desc "Sans Italic 12 @wdth=100,wght=200"
-0 13 foreground #0000ffff0000
-0 13 background #f0f0f0f0f0f0
-0 13 underline double
-0 13 underline-color #ffff00000000
-0 13 gravity south
-0 13 gravity-hint strong
-0 13 strikethrough true
-0 13 strikethrough-color #00000000ffff
-0 13 fallback false
-0 13 language de
-range 13 2147483647
-
-
----
-
-[0:13] de Sans Italic 12 @wdth=100,wght=200
-[13:2147483647] (null) Sans Italic 12 @wdth=100,wght=200
+ERROR: 'yes' is not a valid value for the 'strikethrough' attribute on <span> tag, line 11; valid values are 
none/single/double/dashed/dotted/wavy
\ No newline at end of file
diff --git a/tests/markups/valid-11.expected b/tests/markups/valid-11.expected
index 2a551850..6cc1f9d2 100644
--- a/tests/markups/valid-11.expected
+++ b/tests/markups/valid-11.expected
@@ -5,39 +5,39 @@ Lots of attrs
 
 range 0 5
 0 13 font-desc "Sans Italic 12 @wdth=100,wght=200"
-0 13 foreground #0000ffff0000
-0 13 background #f0f0f0f0f0f0
+0 13 foreground #0000ffff0000ffff
+0 13 background #f0f0f0f0f0f0ffff
 0 13 underline double
-0 13 underline-color #ffff00000000
+0 13 underline-color #ffff00000000ffff
 0 13 gravity south
 0 13 gravity-hint strong
-0 13 strikethrough true
-0 13 strikethrough-color #00000000ffff
+0 13 strikethrough 1
+0 13 strikethrough-color #00000000ffffffff
 0 13 fallback false
 0 13 language de
 range 5 7
 0 13 font-desc "Sans Italic 12 @wdth=100,wght=200"
-0 13 foreground #0000ffff0000
-0 13 background #f0f0f0f0f0f0
+0 13 foreground #0000ffff0000ffff
+0 13 background #f0f0f0f0f0f0ffff
 0 13 underline double
-0 13 underline-color #ffff00000000
+0 13 underline-color #ffff00000000ffff
 0 13 gravity south
 0 13 gravity-hint strong
-0 13 strikethrough true
-0 13 strikethrough-color #00000000ffff
+0 13 strikethrough 1
+0 13 strikethrough-color #00000000ffffffff
 0 13 fallback false
 0 13 language de
 5 7 font-desc "Bold"
 range 7 13
 0 13 font-desc "Sans Italic 12 @wdth=100,wght=200"
-0 13 foreground #0000ffff0000
-0 13 background #f0f0f0f0f0f0
+0 13 foreground #0000ffff0000ffff
+0 13 background #f0f0f0f0f0f0ffff
 0 13 underline double
-0 13 underline-color #ffff00000000
+0 13 underline-color #ffff00000000ffff
 0 13 gravity south
 0 13 gravity-hint strong
-0 13 strikethrough true
-0 13 strikethrough-color #00000000ffff
+0 13 strikethrough 1
+0 13 strikethrough-color #00000000ffffffff
 0 13 fallback false
 0 13 language de
 range 13 2147483647
diff --git a/tests/markups/valid-11.markup b/tests/markups/valid-11.markup
index 6f5828fd..9ded942a 100644
--- a/tests/markups/valid-11.markup
+++ b/tests/markups/valid-11.markup
@@ -3,7 +3,7 @@
       background="#f0f0f0"
       underline="double"
       underline_color="red"
-      strikethrough="t"
+      strikethrough="single"
       strikethrough_color="blue"
       fallback="f"
       lang="de"
diff --git a/tests/markups/valid-12.expected b/tests/markups/valid-12.expected
index 45bbc10c..f7ec233f 100644
--- a/tests/markups/valid-12.expected
+++ b/tests/markups/valid-12.expected
@@ -11,16 +11,16 @@ range 0 8
 0 8 overline single
 range 8 9
 range 9 23
-9 23 overline-color #ffff00000000
+9 23 overline-color #ffff00000000ffff
 range 23 24
 range 24 35
-24 35 underline single-line
+24 35 underline single
 range 35 36
 range 36 47
-36 47 underline double-line
+36 47 underline double
 range 47 48
 range 48 58
-48 58 underline error-line
+48 58 underline wavy
 range 58 2147483647
 
 
diff --git a/tests/markups/valid-12.markup b/tests/markups/valid-12.markup
index 360944d0..a4ce6ee0 100644
--- a/tests/markups/valid-12.markup
+++ b/tests/markups/valid-12.markup
@@ -1,5 +1,5 @@
 <span overline="single">overline</span>
 <span overline_color="red">overline-color</span>
-<span underline="single-line">single-line</span>
-<span underline="double-line">double-line</span>
-<span underline="error-line">error-line</span>
+<span underline="single">single-line</span>
+<span underline="double">double-line</span>
+<span underline="wavy">error-line</span>
diff --git a/tests/markups/valid-13.expected b/tests/markups/valid-13.expected
index c573dd3d..92829d01 100644
--- a/tests/markups/valid-13.expected
+++ b/tests/markups/valid-13.expected
@@ -5,7 +5,8 @@ abc def
 
 range 0 4
 range 4 5
-4 5 underline low
+4 5 underline single
+4 5 underline-position 1
 range 5 2147483647
 
 
diff --git a/tests/markups/valid-14.expected b/tests/markups/valid-14.expected
index 580f9166..7d4fc8c6 100644
--- a/tests/markups/valid-14.expected
+++ b/tests/markups/valid-14.expected
@@ -4,10 +4,12 @@ abc def _x_
 ---
 
 range 0 1
-0 1 underline low
+0 1 underline single
+0 1 underline-position 1
 range 1 4
 range 4 5
-4 5 underline low
+4 5 underline single
+4 5 underline-position 1
 range 5 2147483647
 
 
diff --git a/tests/markups/valid-18.expected b/tests/markups/valid-18.expected
index 78731074..a5eecd20 100644
--- a/tests/markups/valid-18.expected
+++ b/tests/markups/valid-18.expected
@@ -5,14 +5,14 @@ Lots of attrs
 
 range 0 13
 0 13 font-desc "Sans Italic 12"
-0 13 foreground #0000ffff0000
-0 13 background #f0f0f0f0f0f0
+0 13 foreground #0000ffff0000ffff
+0 13 background #f0f0f0f0f0f0ffff
 0 13 underline double
-0 13 underline-color #ffff00000000
+0 13 underline-color #ffff00000000ffff
 0 13 gravity south
 0 13 gravity-hint strong
-0 13 strikethrough true
-0 13 strikethrough-color #00000000ffff
+0 13 strikethrough 1
+0 13 strikethrough-color #00000000ffffffff
 0 13 fallback false
 0 13 language de
 range 13 2147483647
diff --git a/tests/markups/valid-18.markup b/tests/markups/valid-18.markup
index acc4fb51..ee54cb47 100644
--- a/tests/markups/valid-18.markup
+++ b/tests/markups/valid-18.markup
@@ -3,7 +3,7 @@
       background="#f0f0f0"
       underline="double"
       underline_color="red"
-      strikethrough="y"
+      strikethrough="single"
       strikethrough_color="blue"
       fallback="n"
       lang="de"
diff --git a/tests/markups/valid-19.expected b/tests/markups/valid-19.expected
index 9de3df07..c9804982 100644
--- a/tests/markups/valid-19.expected
+++ b/tests/markups/valid-19.expected
@@ -6,7 +6,7 @@ test
 range 0 4
 0 4 family "Times"
 0 4 weight bold
-0 4 foreground #ffff00000000
+0 4 foreground #ffff00000000ffff
 0 4 letter-spacing 1024
 0 4 insert-hyphens true
 range 4 2147483647
diff --git a/tests/markups/valid-2.expected b/tests/markups/valid-2.expected
index 378d49bb..6cfd1e8c 100644
--- a/tests/markups/valid-2.expected
+++ b/tests/markups/valid-2.expected
@@ -5,7 +5,7 @@ Blue text is cool!
 
 range 0 9
 0 9 scale 1.728000
-0 9 foreground #00000000ffff
+0 9 foreground #00000000ffffffff
 range 9 13
 range 13 17
 13 17 style italic
diff --git a/tests/markups/valid-3.expected b/tests/markups/valid-3.expected
index bfc14213..904939b0 100644
--- a/tests/markups/valid-3.expected
+++ b/tests/markups/valid-3.expected
@@ -5,14 +5,14 @@ Lots of attrs
 
 range 0 13
 0 13 font-desc "Sans Italic 12"
-0 13 foreground #0000ffff0000
-0 13 background #f0f0f0f0f0f0
+0 13 foreground #0000ffff0000ffff
+0 13 background #f0f0f0f0f0f0ffff
 0 13 underline double
-0 13 underline-color #ffff00000000
+0 13 underline-color #ffff00000000ffff
 0 13 gravity south
 0 13 gravity-hint strong
-0 13 strikethrough true
-0 13 strikethrough-color #00000000ffff
+0 13 strikethrough 5
+0 13 strikethrough-color #00000000ffffffff
 0 13 fallback false
 0 13 language de
 0 13 allow-breaks true
diff --git a/tests/markups/valid-3.markup b/tests/markups/valid-3.markup
index a17409b0..7c140a10 100644
--- a/tests/markups/valid-3.markup
+++ b/tests/markups/valid-3.markup
@@ -3,7 +3,7 @@
       background="#f0f0f0"
       underline="double"
       underline_color="red"
-      strikethrough="true"
+      strikethrough="wavy"
       strikethrough_color="blue"
       fallback="false"
       allow_breaks="true"
diff --git a/tests/markups/valid-4.expected b/tests/markups/valid-4.expected
index 11ecfab1..52df3afd 100644
--- a/tests/markups/valid-4.expected
+++ b/tests/markups/valid-4.expected
@@ -15,18 +15,18 @@ range 9 15
 9 15 style italic
 range 15 16
 range 16 29
-16 41 strikethrough true
+16 41 strikethrough 1
 range 29 32
-16 41 strikethrough true
+16 41 strikethrough 1
 29 32 font-scale subscript
 29 32 baseline-shift subscript
 range 32 33
-16 41 strikethrough true
+16 41 strikethrough 1
 range 33 38
-16 41 strikethrough true
+16 41 strikethrough 1
 33 38 scale 0.833333
 range 38 41
-16 41 strikethrough true
+16 41 strikethrough 1
 38 41 font-scale superscript
 38 41 baseline-shift superscript
 range 41 42
diff --git a/tests/markups/valid-5.expected b/tests/markups/valid-5.expected
index d6e17249..8a3082dc 100644
--- a/tests/markups/valid-5.expected
+++ b/tests/markups/valid-5.expected
@@ -7,16 +7,16 @@ Text
 ---
 
 range 0 4
-0 4 foreground #222233334444
+0 4 foreground #222233334444ffff
 range 4 5
 range 5 9
-5 9 foreground #222233334444
+5 9 foreground #222233334444ffff
 range 9 10
 range 10 14
-10 14 foreground #222233334444
+10 14 foreground #222233334444ffff
 range 14 15
 range 15 19
-15 19 foreground #222233334444
+15 19 foreground #222233334444ffff
 range 19 2147483647
 
 
diff --git a/tests/markups/valid-6.expected b/tests/markups/valid-6.expected
index 4f1920ad..c7bf8896 100644
--- a/tests/markups/valid-6.expected
+++ b/tests/markups/valid-6.expected
@@ -7,19 +7,16 @@ Text
 ---
 
 range 0 4
-0 4 foreground #222233334444
-0 4 foreground-alpha 21845
+0 4 foreground #2222333344445555
 range 4 5
 range 5 9
-5 9 foreground #222233334444
-5 9 foreground-alpha 21845
+5 9 foreground #2222333344445555
 range 9 10
 range 10 14
-10 14 foreground #222233334444
+10 14 foreground #222233334444ffff
 range 14 15
 range 15 19
-15 19 foreground #222233334444
-15 19 foreground-alpha 21845
+15 19 foreground #2222333344445555
 range 19 2147483647
 
 
diff --git a/tests/markups/valid-7.expected b/tests/markups/valid-7.expected
index 71ba77a9..a3fa498e 100644
--- a/tests/markups/valid-7.expected
+++ b/tests/markups/valid-7.expected
@@ -5,10 +5,10 @@ Text
 ---
 
 range 0 4
-0 4 underline-color #222233334444
+0 4 underline-color #222233334444ffff
 range 4 5
 range 5 9
-5 9 strikethrough-color #222233334444
+5 9 strikethrough-color #222233334444ffff
 range 9 2147483647
 
 
diff --git a/tests/markups/valid-8.expected b/tests/markups/valid-8.expected
index a4fac193..dd262871 100644
--- a/tests/markups/valid-8.expected
+++ b/tests/markups/valid-8.expected
@@ -15,39 +15,33 @@ range 0 4
 0 4 scale 0.578704
 0 4 variant normal
 0 4 stretch ultra-condensed
-0 4 foreground #00000000ffff
-0 4 foreground-alpha 65535
+0 4 foreground #00000000ffffffff
 range 4 5
 range 5 9
 5 9 scale 0.694444
 5 9 variant small-caps
 5 9 stretch extra-condensed
-5 9 foreground #00000000ffff
-5 9 foreground-alpha 32767
+5 9 foreground #00000000ffffffff
 range 9 10
 range 10 14
 10 14 scale 0.833333
 10 14 stretch condensed
-10 14 background #00000000ffff
-10 14 background-alpha 1
+10 14 background #00000000ffffffff
 range 14 15
 range 15 19
 15 19 scale 1.000000
 15 19 stretch semi-condensed
-15 19 background #00000000ffff
-15 19 background-alpha 21626
+15 19 background #00000000ffffffff
 range 19 20
 range 20 24
 20 24 scale 1.200000
 20 24 stretch normal
-20 24 background #00000000ffff
-20 24 background-alpha 21626
+20 24 background #00000000ffffffff
 range 24 25
 range 25 29
 25 29 scale 1.440000
 25 29 stretch semi-expanded
-25 29 background #00000000ffff
-25 29 background-alpha 43690
+25 29 background #00000000ffffaaaa
 range 29 30
 range 30 34
 30 34 scale 1.728000
diff --git a/tests/markups/valid-8.markup b/tests/markups/valid-8.markup
index d314ed16..163c60c7 100644
--- a/tests/markups/valid-8.markup
+++ b/tests/markups/valid-8.markup
@@ -1,8 +1,8 @@
-<span foreground="blue" alpha="65535" size="xx-small" variant="normal" stretch="ultracondensed">Text</span>
-<span fgcolor="blue" fgalpha="50%" size="x-small" font_variant="smallcaps" 
font_stretch="extracondensed">Text</span>
-<span background="blue" background_alpha="1" size="small" stretch="condensed">Text</span>
-<span bgcolor="blue" bgalpha="33%" size="medium" stretch="semicondensed">Text</span>
-<span background="blue" bgalpha="33%" font_size="large" stretch="normal">Text</span>
+<span foreground="blue" size="xx-small" variant="normal" stretch="ultracondensed">Text</span>
+<span fgcolor="blue" size="x-small" font_variant="smallcaps" font_stretch="extracondensed">Text</span>
+<span background="blue" size="small" stretch="condensed">Text</span>
+<span bgcolor="blue" size="medium" stretch="semicondensed">Text</span>
+<span background="blue" font_size="large" stretch="normal">Text</span>
 <span background="#0000ffaa" font_size="x-large" stretch="semiexpanded">Text</span>
 <span font_size="xx-large" stretch="expanded">Text</span>
 <span font_size="xx-large" stretch="extraexpanded">Text</span>
diff --git a/tests/testattributes.c b/tests/testattributes.c
index 71144821..1bcaadcb 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -64,8 +64,6 @@ test_attributes_basic (void)
   test_copy (pango_attr_gravity_new (PANGO_GRAVITY_SOUTH));
   test_copy (pango_attr_gravity_hint_new (PANGO_GRAVITY_HINT_STRONG));
   test_copy (pango_attr_font_features_new ("csc=1"));
-  test_copy (pango_attr_foreground_alpha_new (8000));
-  test_copy (pango_attr_background_alpha_new (8000));
   test_copy (pango_attr_allow_breaks_new (FALSE));
   test_copy (pango_attr_show_new (PANGO_SHOW_SPACES));
   test_copy (pango_attr_insert_hyphens_new (FALSE));
@@ -244,8 +242,6 @@ test_binding_helpers (void)
   test_binding (pango_attr_gravity_new (PANGO_GRAVITY_SOUTH));
   test_binding (pango_attr_gravity_hint_new (PANGO_GRAVITY_HINT_STRONG));
   test_binding (pango_attr_font_features_new ("csc=1"));
-  test_binding (pango_attr_foreground_alpha_new (8000));
-  test_binding (pango_attr_background_alpha_new (8000));
   test_binding (pango_attr_allow_breaks_new (FALSE));
   test_binding (pango_attr_show_new (PANGO_SHOW_SPACES));
   test_binding (pango_attr_insert_hyphens_new (FALSE));
diff --git a/tests/testcolor.c b/tests/testcolor.c
index b32eb6ee..26b4412f 100644
--- a/tests/testcolor.c
+++ b/tests/testcolor.c
@@ -25,92 +25,65 @@
 typedef struct _ColorSpec {
   const gchar *spec;
   gboolean valid;
-  int color_or_alpha;
   guint16 red;
   guint16 green;
   guint16 blue;
   guint16 alpha;
 } ColorSpec;
 
-#define COLOR 1
-#define ALPHA 2
-#define BOTH  3
-
 static void
 test_one_color (ColorSpec *spec)
 {
   PangoColor color;
   gboolean accepted;
-  guint16 alpha;
 
-  if (spec->color_or_alpha & COLOR)
+  accepted = pango_color_parse (&color, spec->spec);
+
+  if (!spec->valid)
     {
-      accepted = pango_color_parse (&color, spec->spec);
-
-      if (!spec->valid)
-        {
-          g_assert_false (accepted);
-        }
-      else
-        {
-          g_assert_true (accepted);
-          g_assert_cmpuint (color.red, ==, spec->red);
-          g_assert_cmpuint (color.green, ==, spec->green);
-          g_assert_cmpuint (color.blue, ==, spec->blue);
-        }
+      g_assert_false (accepted);
     }
-
-  if (spec->color_or_alpha & ALPHA)
+  else
     {
-      accepted = pango_color_parse_with_alpha (&color, &alpha, spec->spec);
-
-      if (!spec->valid)
-        {
-          g_assert_false (accepted);
-        }
-      else
-        {
-          g_assert_true (accepted);
-          g_assert_cmpuint (color.red, ==, spec->red);
-          g_assert_cmpuint (color.green, ==, spec->green);
-          g_assert_cmpuint (color.blue, ==, spec->blue);
-          g_assert_cmpuint (alpha, ==, spec->alpha);
-        }
+      g_assert_true (accepted);
+      g_assert_cmpuint (color.red, ==, spec->red);
+      g_assert_cmpuint (color.green, ==, spec->green);
+      g_assert_cmpuint (color.blue, ==, spec->blue);
+      g_assert_cmpuint (color.alpha, ==, spec->alpha);
     }
 }
 
 ColorSpec specs [] = {
-  { "#abc",          1, BOTH, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
-  { "#aabbcc",       1, BOTH, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
-  { "#aaabbbccc",    1, BOTH, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
-  { "#100100100",    1, BOTH, 0x1001, 0x1001, 0x1001, 0xffff },
-  { "#aaaabbbbcccc", 1, COLOR, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
-  { "#fff",          1, BOTH, 0xffff, 0xffff, 0xffff, 0xffff },
-  { "#ffffff",       1, BOTH, 0xffff, 0xffff, 0xffff, 0xffff },
-  { "#fffffffff",    1, BOTH, 0xffff, 0xffff, 0xffff, 0xffff },
-  { "#ffffffffffff", 1, COLOR, 0xffff, 0xffff, 0xffff, 0xffff },
-  { "#000",          1, BOTH, 0x0000, 0x0000, 0x0000, 0xffff },
-  { "#000000",       1, BOTH, 0x0000, 0x0000, 0x0000, 0xffff },
-  { "#000000000",    1, BOTH, 0x0000, 0x0000, 0x0000, 0xffff },
-  { "#000000000000", 1, COLOR, 0x0000, 0x0000, 0x0000, 0xffff },
-  { "#AAAABBBBCCCC", 1, COLOR, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
-  { "#aa bb cc ",    0, BOTH, 0, 0, 0, 0 },
-  { "#aa bb ccc",    0, BOTH, 0, 0, 0, 0 },
-  { "#ab",           0, BOTH, 0, 0, 0, 0 },
-  { "#aabb",         0, COLOR, 0, 0, 0, 0 },
-  { "#aaabb",        0, BOTH, 0, 0, 0, 0 },
-  { "aaabb",         0, BOTH, 0, 0, 0, 0 },
-  { "",              0, BOTH, 0, 0, 0, 0 },
-  { "#",             0, BOTH, 0, 0, 0, 0 },
-  { "##fff",         0, BOTH, 0, 0, 0, 0 },
-  { "#0000ff+",      0, BOTH, 0, 0, 0, 0 },
-  { "#0000f+",       0, BOTH, 0, 0, 0, 0 },
-  { "#0x00x10x2",    0, BOTH, 0, 0, 0, 0 },
-  { "#abcd",         1, ALPHA, 0xaaaa, 0xbbbb, 0xcccc, 0xdddd },
-  { "#aabbccdd",     1, ALPHA, 0xaaaa, 0xbbbb, 0xcccc, 0xdddd },
-  { "#aaaabbbbccccdddd",
-                     1, ALPHA, 0xaaaa, 0xbbbb, 0xcccc, 0xdddd },
-  { NULL,            0, BOTH, 0, 0, 0, 0 }
+  { "#abc",          1, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
+  { "#aabbcc",       1, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
+  { "#aaabbbccc",    1, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
+  { "#100100100",    1, 0x1001, 0x1001, 0x1001, 0xffff },
+  { "#aaaabbbbcccc", 1, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
+  { "#fff",          1, 0xffff, 0xffff, 0xffff, 0xffff },
+  { "#ffffff",       1, 0xffff, 0xffff, 0xffff, 0xffff },
+  { "#fffffffff",    1, 0xffff, 0xffff, 0xffff, 0xffff },
+  { "#ffffffffffff", 1, 0xffff, 0xffff, 0xffff, 0xffff },
+  { "#000",          1, 0x0000, 0x0000, 0x0000, 0xffff },
+  { "#000000",       1, 0x0000, 0x0000, 0x0000, 0xffff },
+  { "#000000000",    1, 0x0000, 0x0000, 0x0000, 0xffff },
+  { "#000000000000", 1, 0x0000, 0x0000, 0x0000, 0xffff },
+  { "#AAAABBBBCCCC", 1, 0xaaaa, 0xbbbb, 0xcccc, 0xffff },
+  { "#aa bb cc ",    0, 0, 0, 0, 0 },
+  { "#aa bb ccc",    0, 0, 0, 0, 0 },
+  { "#ab",           0, 0, 0, 0, 0 },
+  { "#aabb",         1, 0xaaaa, 0xaaaa, 0xbbbb, 0xbbbb },
+  { "#aaabb",        0, 0, 0, 0, 0 },
+  { "aaabb",         0, 0, 0, 0, 0 },
+  { "",              0, 0, 0, 0, 0 },
+  { "#",             0, 0, 0, 0, 0 },
+  { "##fff",         0, 0, 0, 0, 0 },
+  { "#0000ff+",      0, 0, 0, 0, 0 },
+  { "#0000f+",       0, 0, 0, 0, 0 },
+  { "#0x00x10x2",    0, 0, 0, 0, 0 },
+  { "#abcd",         1, 0xaaaa, 0xbbbb, 0xcccc, 0xdddd },
+  { "#aabbccdd",     1, 0xaaaa, 0xbbbb, 0xcccc, 0xdddd },
+  { "#aaaabbbbccccdddd", 1, 0xaaaa, 0xbbbb, 0xcccc, 0xdddd },
+  { NULL,            0, 0, 0, 0, 0 }
 };
 
 static void
@@ -125,7 +98,7 @@ test_color (void)
 static void
 test_color_copy (void)
 {
-  PangoColor orig = { 0, 200, 5000 };
+  PangoColor orig = { 0, 200, 5000, 666 };
   PangoColor *copy;
 
   copy = pango_color_copy (&orig);
@@ -133,6 +106,7 @@ test_color_copy (void)
   g_assert_cmpint (orig.red, ==, copy->red);
   g_assert_cmpint (orig.green, ==, copy->green);
   g_assert_cmpint (orig.blue, ==, copy->blue);
+  g_assert_cmpint (orig.alpha, ==, copy->alpha);
 
   pango_color_free (copy);
 }
@@ -140,12 +114,12 @@ test_color_copy (void)
 static void
 test_color_serialize (void)
 {
-  PangoColor orig = { 0, 200, 5000 };
+  PangoColor orig = { 0, 200, 5000, 666 };
   char *string;
 
   string = pango_color_to_string (&orig);
 
-  g_assert_cmpstr (string, ==, "#000000c81388");
+  g_assert_cmpstr (string, ==, "#000000c81388029a");
 
   g_free (string);
 }
diff --git a/tests/testserialize.c b/tests/testserialize.c
index 8f62cfc8..842beba3 100644
--- a/tests/testserialize.c
+++ b/tests/testserialize.c
@@ -41,8 +41,8 @@ test_serialize_attr_list (void)
   };
   const char *roundtripped[] = {
     "5 16 style italic",
-    "0 10 foreground #ffff00000000\n5 15 weight bold\n0 200 font-desc \"Sans Small-Caps 10\"",
-    "0 10 foreground #ffff00000000\n5 15 weight bold\n0 200 font-desc \"Sans Small-Caps 10\"",
+    "0 10 foreground #ffff00000000ffff\n5 15 weight bold\n0 200 font-desc \"Sans Small-Caps 10\"",
+    "0 10 foreground #ffff00000000ffff\n5 15 weight bold\n0 200 font-desc \"Sans Small-Caps 10\"",
     "0 10 fallback false\n5 15 weight semilight",
     "0 100 font-desc \"Cantarell,Sans Ultra-Light Italic 64\"\n10 11 weight thin",
     "0 4294967295 size 10",
@@ -230,18 +230,18 @@ test_serialize_layout_valid (void)
     "    {\n"
     "      \"end\" : 4,\n"
     "      \"type\" : \"foreground\",\n"
-    "      \"value\" : \"#ffff00000000\"\n"
+    "      \"value\" : \"#ffff00000000ffff\"\n"
     "    },\n"
     "    {\n"
     "      \"start\" : 5,\n"
     "      \"end\" : 8,\n"
     "      \"type\" : \"foreground\",\n"
-    "      \"value\" : \"#000080800000\"\n"
+    "      \"value\" : \"#000080800000ffff\"\n"
     "    },\n"
     "    {\n"
     "      \"start\" : 14,\n"
     "      \"type\" : \"foreground\",\n"
-    "      \"value\" : \"#ffff0000ffff\"\n"
+    "      \"value\" : \"#ffff0000ffffffff\"\n"
     "    }\n"
     "  ],\n"
     "  \"font\" : \"Sans Bold 32\",\n"


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