mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
Make overline support conditional
The ci image does not have Pango 1.45, so for the time being, make the overline support conditional on Pango being new enough.
This commit is contained in:
parent
72f06abd13
commit
9259efb5d7
@ -4758,10 +4758,6 @@ get_tag_for_attributes (PangoAttrIterator *iter)
|
||||
if (attr)
|
||||
g_object_set (tag, "underline", ((PangoAttrInt*)attr)->value, NULL);
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_OVERLINE);
|
||||
if (attr)
|
||||
g_object_set (tag, "overline", ((PangoAttrInt*)attr)->value, NULL);
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_UNDERLINE_COLOR);
|
||||
if (attr)
|
||||
{
|
||||
@ -4776,6 +4772,11 @@ get_tag_for_attributes (PangoAttrIterator *iter)
|
||||
g_object_set (tag, "underline-rgba", &rgba, NULL);
|
||||
}
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_OVERLINE);
|
||||
if (attr)
|
||||
g_object_set (tag, "overline", ((PangoAttrInt*)attr)->value, NULL);
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_OVERLINE_COLOR);
|
||||
if (attr)
|
||||
{
|
||||
@ -4789,6 +4790,7 @@ get_tag_for_attributes (PangoAttrIterator *iter)
|
||||
rgba.alpha = 1.;
|
||||
g_object_set (tag, "overline-rgba", &rgba, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_STRIKETHROUGH);
|
||||
if (attr)
|
||||
|
@ -1585,9 +1585,11 @@ add_generic_attrs (GtkTextLayout *layout,
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
if (appearance->overline != PANGO_OVERLINE_NONE)
|
||||
if (appearance->underline_rgba)
|
||||
{
|
||||
attr = pango_attr_overline_new (appearance->overline);
|
||||
attr = pango_attr_underline_color_new (appearance->underline_rgba->red * 65535,
|
||||
appearance->underline_rgba->green * 65535,
|
||||
appearance->underline_rgba->blue * 65535);
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
@ -1595,11 +1597,10 @@ add_generic_attrs (GtkTextLayout *layout,
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
if (appearance->underline_rgba)
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
if (appearance->overline != PANGO_OVERLINE_NONE)
|
||||
{
|
||||
attr = pango_attr_underline_color_new (appearance->underline_rgba->red * 65535,
|
||||
appearance->underline_rgba->green * 65535,
|
||||
appearance->underline_rgba->blue * 65535);
|
||||
attr = pango_attr_overline_new (appearance->overline);
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
@ -1618,6 +1619,7 @@ add_generic_attrs (GtkTextLayout *layout,
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (appearance->strikethrough)
|
||||
{
|
||||
@ -2131,21 +2133,23 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
case PANGO_ATTR_UNDERLINE:
|
||||
appearance.underline = ((PangoAttrInt *)attr)->value;
|
||||
break;
|
||||
case PANGO_ATTR_OVERLINE:
|
||||
appearance.overline = ((PangoAttrInt *)attr)->value;
|
||||
break;
|
||||
case PANGO_ATTR_UNDERLINE_COLOR:
|
||||
convert_color (&rgba, (PangoAttrColor*)attr);
|
||||
if (appearance.underline_rgba)
|
||||
gdk_rgba_free (appearance.underline_rgba);
|
||||
appearance.underline_rgba = gdk_rgba_copy (&rgba);
|
||||
break;
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
case PANGO_ATTR_OVERLINE:
|
||||
appearance.overline = ((PangoAttrInt *)attr)->value;
|
||||
break;
|
||||
case PANGO_ATTR_OVERLINE_COLOR:
|
||||
convert_color (&rgba, (PangoAttrColor*)attr);
|
||||
if (appearance.overline_rgba)
|
||||
gdk_rgba_free (appearance.overline_rgba);
|
||||
appearance.overline_rgba = gdk_rgba_copy (&rgba);
|
||||
break;
|
||||
#endif
|
||||
case PANGO_ATTR_STRIKETHROUGH:
|
||||
appearance.strikethrough = ((PangoAttrInt *)attr)->value;
|
||||
break;
|
||||
|
@ -116,9 +116,11 @@ enum {
|
||||
PROP_STRIKETHROUGH_RGBA,
|
||||
PROP_RIGHT_MARGIN,
|
||||
PROP_UNDERLINE,
|
||||
PROP_OVERLINE,
|
||||
PROP_UNDERLINE_RGBA,
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
PROP_OVERLINE,
|
||||
PROP_OVERLINE_RGBA,
|
||||
#endif
|
||||
PROP_RISE,
|
||||
PROP_BACKGROUND_FULL_HEIGHT,
|
||||
PROP_LANGUAGE,
|
||||
@ -158,9 +160,11 @@ enum {
|
||||
PROP_STRIKETHROUGH_RGBA_SET,
|
||||
PROP_RIGHT_MARGIN_SET,
|
||||
PROP_UNDERLINE_SET,
|
||||
PROP_OVERLINE_SET,
|
||||
PROP_UNDERLINE_RGBA_SET,
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
PROP_OVERLINE_SET,
|
||||
PROP_OVERLINE_RGBA_SET,
|
||||
#endif
|
||||
PROP_RISE_SET,
|
||||
PROP_BACKGROUND_FULL_HEIGHT_SET,
|
||||
PROP_LANGUAGE_SET,
|
||||
@ -492,15 +496,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
PANGO_UNDERLINE_NONE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_OVERLINE,
|
||||
g_param_spec_enum ("overline",
|
||||
P_("Overline"),
|
||||
P_("Style of overline for this text"),
|
||||
PANGO_TYPE_OVERLINE,
|
||||
PANGO_OVERLINE_NONE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkTextTag:underline-rgba:
|
||||
*
|
||||
@ -519,6 +514,16 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_OVERLINE,
|
||||
g_param_spec_enum ("overline",
|
||||
P_("Overline"),
|
||||
P_("Style of overline for this text"),
|
||||
PANGO_TYPE_OVERLINE,
|
||||
PANGO_OVERLINE_NONE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_OVERLINE_RGBA,
|
||||
g_param_spec_boxed ("overline-rgba",
|
||||
@ -526,6 +531,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
P_("Color of overline for this text"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GtkTextTag:strikethrough-rgba:
|
||||
@ -778,10 +784,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
P_("Underline set"),
|
||||
P_("Whether this tag affects underlining"));
|
||||
|
||||
ADD_SET_PROP ("overline-set", PROP_OVERLINE_SET,
|
||||
P_("Overline set"),
|
||||
P_("Whether this tag affects overlining"));
|
||||
|
||||
/**
|
||||
* GtkTextTag:underline-rgba-set:
|
||||
*
|
||||
@ -791,9 +793,15 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
P_("Underline RGBA set"),
|
||||
P_("Whether this tag affects underlining color"));
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
ADD_SET_PROP ("overline-set", PROP_OVERLINE_SET,
|
||||
P_("Overline set"),
|
||||
P_("Whether this tag affects overlining"));
|
||||
|
||||
ADD_SET_PROP ("overline-rgba-set", PROP_OVERLINE_RGBA_SET,
|
||||
P_("Overline RGBA set"),
|
||||
P_("Whether this tag affects overlining color"));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GtkTextTag:strikethrough-rgba-set:
|
||||
@ -921,6 +929,7 @@ set_underline_rgba (GtkTextTag *tag,
|
||||
}
|
||||
}
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
static void
|
||||
set_overline_rgba (GtkTextTag *tag,
|
||||
const GdkRGBA *rgba)
|
||||
@ -950,6 +959,7 @@ set_overline_rgba (GtkTextTag *tag,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_strikethrough_rgba (GtkTextTag *tag,
|
||||
@ -1468,12 +1478,6 @@ gtk_text_tag_set_property (GObject *object,
|
||||
g_object_notify (object, "underline-set");
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE:
|
||||
priv->overline_set = TRUE;
|
||||
priv->values->appearance.overline = g_value_get_enum (value);
|
||||
g_object_notify (object, "overline-set");
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE_RGBA:
|
||||
{
|
||||
GdkRGBA *color = g_value_get_boxed (value);
|
||||
@ -1481,12 +1485,20 @@ gtk_text_tag_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
case PROP_OVERLINE:
|
||||
priv->overline_set = TRUE;
|
||||
priv->values->appearance.overline = g_value_get_enum (value);
|
||||
g_object_notify (object, "overline-set");
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE_RGBA:
|
||||
{
|
||||
GdkRGBA *color = g_value_get_boxed (value);
|
||||
set_overline_rgba (text_tag, color);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_RISE:
|
||||
priv->rise_set = TRUE;
|
||||
@ -1686,17 +1698,19 @@ gtk_text_tag_set_property (GObject *object,
|
||||
priv->underline_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE_SET:
|
||||
priv->overline_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE_RGBA_SET:
|
||||
priv->underline_rgba_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
case PROP_OVERLINE_SET:
|
||||
priv->overline_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE_RGBA_SET:
|
||||
priv->overline_rgba_set = g_value_get_boolean (value);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_RISE_SET:
|
||||
priv->rise_set = g_value_get_boolean (value);
|
||||
@ -1894,19 +1908,21 @@ gtk_text_tag_get_property (GObject *object,
|
||||
g_value_set_enum (value, priv->values->appearance.underline);
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE:
|
||||
g_value_set_enum (value, priv->values->appearance.overline);
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE_RGBA:
|
||||
if (priv->underline_rgba_set)
|
||||
g_value_set_boxed (value, priv->values->appearance.underline_rgba);
|
||||
break;
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
case PROP_OVERLINE:
|
||||
g_value_set_enum (value, priv->values->appearance.overline);
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE_RGBA:
|
||||
if (priv->overline_rgba_set)
|
||||
g_value_set_boxed (value, priv->values->appearance.overline_rgba);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_RISE:
|
||||
g_value_set_int (value, priv->values->appearance.rise);
|
||||
@ -2036,17 +2052,19 @@ gtk_text_tag_get_property (GObject *object,
|
||||
g_value_set_boolean (value, priv->underline_set);
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE_SET:
|
||||
g_value_set_boolean (value, priv->overline_set);
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE_RGBA_SET:
|
||||
g_value_set_boolean (value, priv->underline_rgba_set);
|
||||
break;
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
case PROP_OVERLINE_SET:
|
||||
g_value_set_boolean (value, priv->overline_set);
|
||||
break;
|
||||
|
||||
case PROP_OVERLINE_RGBA_SET:
|
||||
g_value_set_boolean (value, priv->overline_rgba_set);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PROP_RISE_SET:
|
||||
g_value_set_boolean (value, priv->rise_set);
|
||||
|
Loading…
Reference in New Issue
Block a user