Merge branch 'new-text-attributes' into 'master'
New text attributes See merge request GNOME/gtk!1547
This commit is contained in:
@@ -78,7 +78,7 @@ do_markup (GtkWidget *do_widget)
|
||||
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD_CHAR);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 10);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 10);
|
||||
|
||||
|
||||
@@ -14,3 +14,7 @@ Superscripts and subscripts: 𝜀<span rise="-6000" size="x-small" font_desc="it
|
||||
OpenType font features: <span font_desc="sans regular" font_features="dlig=0">feast</span> versus <span font_desc="sans regular" font_features="dlig=1">feast</span>
|
||||
|
||||
Shortcuts: <tt>Monospace</tt> – <b>Bold</b> – <i>Italic</i> – <big>Big</big> – <small>Small</small> – <u>Underlined</u> – <s>Strikethrough</s> – Super<sup>script</sup> – Sub<sub>script</sub>
|
||||
|
||||
<span allow_breaks="false">A</span> hyphenation algorithm is a set of rules, especially one codified for implementation in a computer program, that decides at which points a word can be broken over two lines with a hyphen. For example, a hyphenation algorithm might decide that impeachment can be broken as <span allow_breaks="false">impeach‧ment</span> or <span allow_breaks="false">im‧peachment</span> but not <span allow_breaks="false">impe‧achment.</span>
|
||||
|
||||
<span insert_hyphens="false">one/two three/four five/six seven/eight nine/ten</span>
|
||||
|
||||
@@ -140,6 +140,9 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
|
||||
if (dest->appearance.underline_rgba)
|
||||
gdk_rgba_free (dest->appearance.underline_rgba);
|
||||
|
||||
if (dest->appearance.overline_rgba)
|
||||
gdk_rgba_free (dest->appearance.overline_rgba);
|
||||
|
||||
if (dest->appearance.strikethrough_rgba)
|
||||
gdk_rgba_free (dest->appearance.strikethrough_rgba);
|
||||
|
||||
@@ -171,6 +174,9 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
|
||||
if (src->appearance.underline_rgba)
|
||||
dest->appearance.underline_rgba = gdk_rgba_copy (src->appearance.underline_rgba);
|
||||
|
||||
if (src->appearance.overline_rgba)
|
||||
dest->appearance.overline_rgba = gdk_rgba_copy (src->appearance.overline_rgba);
|
||||
|
||||
if (src->appearance.strikethrough_rgba)
|
||||
dest->appearance.strikethrough_rgba = gdk_rgba_copy (src->appearance.strikethrough_rgba);
|
||||
|
||||
@@ -233,6 +239,9 @@ gtk_text_attributes_unref (GtkTextAttributes *values)
|
||||
if (values->appearance.underline_rgba)
|
||||
gdk_rgba_free (values->appearance.underline_rgba);
|
||||
|
||||
if (values->appearance.overline_rgba)
|
||||
gdk_rgba_free (values->appearance.underline_rgba);
|
||||
|
||||
if (values->appearance.strikethrough_rgba)
|
||||
gdk_rgba_free (values->appearance.strikethrough_rgba);
|
||||
|
||||
@@ -300,6 +309,18 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
|
||||
dest->appearance.underline_rgba = gdk_rgba_copy (vals->appearance.underline_rgba);
|
||||
}
|
||||
|
||||
if (tag->priv->overline_rgba_set)
|
||||
{
|
||||
if (dest->appearance.overline_rgba)
|
||||
{
|
||||
gdk_rgba_free (dest->appearance.overline_rgba);
|
||||
dest->appearance.overline_rgba = NULL;
|
||||
}
|
||||
|
||||
if (vals->appearance.overline_rgba)
|
||||
dest->appearance.overline_rgba = gdk_rgba_copy (vals->appearance.overline_rgba);
|
||||
}
|
||||
|
||||
if (tag->priv->strikethrough_rgba_set)
|
||||
{
|
||||
if (dest->appearance.strikethrough_rgba)
|
||||
@@ -386,6 +407,9 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
|
||||
if (tag->priv->underline_set)
|
||||
dest->appearance.underline = vals->appearance.underline;
|
||||
|
||||
if (tag->priv->overline_set)
|
||||
dest->appearance.overline = vals->appearance.overline;
|
||||
|
||||
if (tag->priv->strikethrough_set)
|
||||
dest->appearance.strikethrough = vals->appearance.strikethrough;
|
||||
|
||||
@@ -410,6 +434,15 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
|
||||
if (tag->priv->font_features_set)
|
||||
dest->font_features = g_strdup (vals->font_features);
|
||||
|
||||
if (tag->priv->allow_breaks_set)
|
||||
dest->no_breaks = vals->no_breaks;
|
||||
|
||||
if (tag->priv->show_spaces_set)
|
||||
dest->show_spaces = vals->show_spaces;
|
||||
|
||||
if (tag->priv->insert_hyphens_set)
|
||||
dest->no_hyphens = vals->no_hyphens;
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
@@ -435,6 +468,7 @@ _gtk_text_tag_affects_size (GtkTextTag *tag)
|
||||
priv->pixels_inside_wrap_set ||
|
||||
priv->tabs_set ||
|
||||
priv->underline_set ||
|
||||
priv->overline_set ||
|
||||
priv->wrap_mode_set ||
|
||||
priv->invisible_set ||
|
||||
priv->font_features_set ||
|
||||
@@ -454,5 +488,7 @@ _gtk_text_tag_affects_nonsize_appearance (GtkTextTag *tag)
|
||||
priv->pg_bg_color_set ||
|
||||
priv->fallback_set ||
|
||||
priv->underline_rgba_set ||
|
||||
priv->strikethrough_rgba_set;
|
||||
priv->overline_rgba_set ||
|
||||
priv->strikethrough_rgba_set ||
|
||||
priv->show_spaces_set;
|
||||
}
|
||||
|
||||
@@ -87,12 +87,14 @@ struct _GtkTextAppearance
|
||||
GdkRGBA *bg_rgba;
|
||||
GdkRGBA *fg_rgba;
|
||||
GdkRGBA *underline_rgba;
|
||||
GdkRGBA *overline_rgba;
|
||||
GdkRGBA *strikethrough_rgba;
|
||||
|
||||
/* super/subscript rise, can be negative */
|
||||
gint rise;
|
||||
|
||||
guint underline : 4; /* PangoUnderline */
|
||||
guint overline : 2; /* PangoOverline */
|
||||
guint strikethrough : 1;
|
||||
|
||||
/* Whether to use background-related values; this is irrelevant for
|
||||
@@ -170,6 +172,10 @@ struct _GtkTextAttributes
|
||||
guint bg_full_height : 1;
|
||||
guint editable : 1;
|
||||
guint no_fallback: 1;
|
||||
guint no_breaks : 1;
|
||||
guint show_spaces : 3; /* PangoShowFlags */
|
||||
gint no_hyphens : 1;
|
||||
|
||||
|
||||
GdkRGBA *pg_bg_rgba;
|
||||
|
||||
|
||||
@@ -4772,6 +4772,26 @@ 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)
|
||||
{
|
||||
PangoColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = &((PangoAttrColor*)attr)->color;
|
||||
rgba.red = color->red / 65535.;
|
||||
rgba.green = color->green / 65535.;
|
||||
rgba.blue = color->blue / 65535.;
|
||||
rgba.alpha = 1.;
|
||||
g_object_set (tag, "overline-rgba", &rgba, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_STRIKETHROUGH);
|
||||
if (attr)
|
||||
g_object_set (tag, "strikethrough", (gboolean) (((PangoAttrInt*)attr)->value != 0), NULL);
|
||||
@@ -4810,6 +4830,18 @@ get_tag_for_attributes (PangoAttrIterator *iter)
|
||||
if (attr)
|
||||
g_object_set (tag, "font-features", ((PangoAttrString*)attr)->value, NULL);
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_ALLOW_BREAKS);
|
||||
if (attr)
|
||||
g_object_set (tag, "allow-breaks", ((PangoAttrInt*)attr)->value, NULL);
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_SHOW);
|
||||
if (attr)
|
||||
g_object_set (tag, "show-spaces", ((PangoAttrInt*)attr)->value, NULL);
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_INSERT_HYPHENS);
|
||||
if (attr)
|
||||
g_object_set (tag, "insert-hyphens", ((PangoAttrInt*)attr)->value, NULL);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
@@ -1452,6 +1452,9 @@ gtk_text_attr_appearance_destroy (PangoAttribute *attr)
|
||||
if (appearance_attr->appearance.underline_rgba)
|
||||
gdk_rgba_free (appearance_attr->appearance.underline_rgba);
|
||||
|
||||
if (appearance_attr->appearance.overline_rgba)
|
||||
gdk_rgba_free (appearance_attr->appearance.overline_rgba);
|
||||
|
||||
if (appearance_attr->appearance.strikethrough_rgba)
|
||||
gdk_rgba_free (appearance_attr->appearance.strikethrough_rgba);
|
||||
|
||||
@@ -1479,6 +1482,15 @@ underline_equal (const GtkTextAppearance *appearance1,
|
||||
(const GdkRGBA *)appearance2->underline_rgba);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
overline_equal (const GtkTextAppearance *appearance1,
|
||||
const GtkTextAppearance *appearance2)
|
||||
{
|
||||
return (appearance1->overline == appearance2->overline) &&
|
||||
rgba_equal ((const GdkRGBA *)appearance1->overline_rgba,
|
||||
(const GdkRGBA *)appearance2->overline_rgba);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
strikethrough_equal (const GtkTextAppearance *appearance1,
|
||||
const GtkTextAppearance *appearance2)
|
||||
@@ -1495,11 +1507,12 @@ gtk_text_attr_appearance_compare (const PangoAttribute *attr1,
|
||||
const GtkTextAppearance *appearance1 = &((const GtkTextAttrAppearance *)attr1)->appearance;
|
||||
const GtkTextAppearance *appearance2 = &((const GtkTextAttrAppearance *)attr2)->appearance;
|
||||
|
||||
return (rgba_equal (appearance1->fg_rgba, appearance2->fg_rgba) &&
|
||||
rgba_equal (appearance1->bg_rgba, appearance2->bg_rgba) &&
|
||||
appearance1->draw_bg == appearance2->draw_bg &&
|
||||
strikethrough_equal (appearance1, appearance2) &&
|
||||
underline_equal (appearance1, appearance2));
|
||||
return rgba_equal (appearance1->fg_rgba, appearance2->fg_rgba) &&
|
||||
rgba_equal (appearance1->bg_rgba, appearance2->bg_rgba) &&
|
||||
appearance1->draw_bg == appearance2->draw_bg &&
|
||||
strikethrough_equal (appearance1, appearance2) &&
|
||||
underline_equal (appearance1, appearance2) &&
|
||||
overline_equal (appearance1, appearance2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1542,6 +1555,9 @@ gtk_text_attr_appearance_new (const GtkTextAppearance *appearance)
|
||||
if (appearance->underline_rgba)
|
||||
result->appearance.underline_rgba = gdk_rgba_copy (appearance->underline_rgba);
|
||||
|
||||
if (appearance->overline_rgba)
|
||||
result->appearance.overline_rgba = gdk_rgba_copy (appearance->overline_rgba);
|
||||
|
||||
if (appearance->strikethrough_rgba)
|
||||
result->appearance.strikethrough_rgba = gdk_rgba_copy (appearance->strikethrough_rgba);
|
||||
|
||||
@@ -1581,6 +1597,30 @@ add_generic_attrs (GtkTextLayout *layout,
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
if (appearance->overline != PANGO_OVERLINE_NONE)
|
||||
{
|
||||
attr = pango_attr_overline_new (appearance->overline);
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
if (appearance->overline_rgba)
|
||||
{
|
||||
attr = pango_attr_overline_color_new (appearance->overline_rgba->red * 65535,
|
||||
appearance->overline_rgba->green * 65535,
|
||||
appearance->overline_rgba->blue * 65535);
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (appearance->strikethrough)
|
||||
{
|
||||
attr = pango_attr_strikethrough_new (appearance->strikethrough);
|
||||
@@ -1707,6 +1747,34 @@ add_text_attrs (GtkTextLayout *layout,
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
if (style->no_breaks)
|
||||
{
|
||||
attr = pango_attr_allow_breaks_new (FALSE);
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
if (style->show_spaces != PANGO_SHOW_NONE)
|
||||
{
|
||||
attr = pango_attr_show_new (style->show_spaces);
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
if (style->no_hyphens)
|
||||
{
|
||||
attr = pango_attr_insert_hyphens_new (FALSE);
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2036,6 +2104,8 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
appearance.bg_rgba = gdk_rgba_copy (appearance.bg_rgba);
|
||||
if (appearance.underline_rgba)
|
||||
appearance.underline_rgba = gdk_rgba_copy (appearance.underline_rgba);
|
||||
if (appearance.overline_rgba)
|
||||
appearance.overline_rgba = gdk_rgba_copy (appearance.overline_rgba);
|
||||
if (appearance.strikethrough_rgba)
|
||||
appearance.strikethrough_rgba = gdk_rgba_copy (appearance.strikethrough_rgba);
|
||||
|
||||
@@ -2069,6 +2139,17 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
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;
|
||||
@@ -2116,6 +2197,8 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
gdk_rgba_free (appearance.bg_rgba);
|
||||
if (appearance.underline_rgba)
|
||||
gdk_rgba_free (appearance.underline_rgba);
|
||||
if (appearance.overline_rgba)
|
||||
gdk_rgba_free (appearance.overline_rgba);
|
||||
if (appearance.strikethrough_rgba)
|
||||
gdk_rgba_free (appearance.strikethrough_rgba);
|
||||
|
||||
|
||||
212
gtk/gtktexttag.c
212
gtk/gtktexttag.c
@@ -117,6 +117,10 @@ enum {
|
||||
PROP_RIGHT_MARGIN,
|
||||
PROP_UNDERLINE,
|
||||
PROP_UNDERLINE_RGBA,
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
PROP_OVERLINE,
|
||||
PROP_OVERLINE_RGBA,
|
||||
#endif
|
||||
PROP_RISE,
|
||||
PROP_BACKGROUND_FULL_HEIGHT,
|
||||
PROP_LANGUAGE,
|
||||
@@ -127,6 +131,9 @@ enum {
|
||||
PROP_FALLBACK,
|
||||
PROP_LETTER_SPACING,
|
||||
PROP_FONT_FEATURES,
|
||||
PROP_ALLOW_BREAKS,
|
||||
PROP_SHOW_SPACES,
|
||||
PROP_INSERT_HYPHENS,
|
||||
|
||||
/* Behavior args */
|
||||
PROP_ACCUMULATIVE_MARGIN,
|
||||
@@ -154,6 +161,10 @@ enum {
|
||||
PROP_RIGHT_MARGIN_SET,
|
||||
PROP_UNDERLINE_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,
|
||||
@@ -163,6 +174,9 @@ enum {
|
||||
PROP_FALLBACK_SET,
|
||||
PROP_LETTER_SPACING_SET,
|
||||
PROP_FONT_FEATURES_SET,
|
||||
PROP_ALLOW_BREAKS_SET,
|
||||
PROP_SHOW_SPACES_SET,
|
||||
PROP_INSERT_HYPHENS_SET,
|
||||
|
||||
LAST_ARG
|
||||
};
|
||||
@@ -500,6 +514,25 @@ 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",
|
||||
P_("Overline RGBA"),
|
||||
P_("Color of overline for this text"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GtkTextTag:strikethrough-rgba:
|
||||
*
|
||||
@@ -617,6 +650,31 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_ALLOW_BREAKS,
|
||||
g_param_spec_boolean ("allow-breaks",
|
||||
P_("Allow Breaks"),
|
||||
P_("Whether breaks are allowed."),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_SHOW_SPACES,
|
||||
g_param_spec_flags ("show-spaces",
|
||||
P_("Show spaces"),
|
||||
P_("How to render invisible characters."),
|
||||
PANGO_TYPE_SHOW_FLAGS,
|
||||
PANGO_SHOW_NONE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_INSERT_HYPHENS,
|
||||
g_param_spec_boolean ("insert-hyphens",
|
||||
P_("Insert hyphens"),
|
||||
P_("Whether to insert hyphens at breaks."),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkTextTag:accumulative-margin:
|
||||
*
|
||||
@@ -735,6 +793,16 @@ 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:
|
||||
*
|
||||
@@ -771,6 +839,18 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
ADD_SET_PROP ("font-features-set", PROP_FONT_FEATURES_SET,
|
||||
P_("Font features set"),
|
||||
P_("Whether this tag affects font features"));
|
||||
|
||||
ADD_SET_PROP ("allow-breaks-set", PROP_ALLOW_BREAKS_SET,
|
||||
P_("Allow breaks set"),
|
||||
P_("Whether this tag affects line breaks"));
|
||||
|
||||
ADD_SET_PROP ("show-spaces-set", PROP_SHOW_SPACES_SET,
|
||||
P_("Show spaces set"),
|
||||
P_("Whether this tag affects rendering of invisible characters"));
|
||||
|
||||
ADD_SET_PROP ("insert-hyphens-set", PROP_INSERT_HYPHENS_SET,
|
||||
P_("Insert hyphens set"),
|
||||
P_("Whether this tag affects insertion of hyphens"));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -849,6 +929,38 @@ set_underline_rgba (GtkTextTag *tag,
|
||||
}
|
||||
}
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,45,0)
|
||||
static void
|
||||
set_overline_rgba (GtkTextTag *tag,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GtkTextTagPrivate *priv = tag->priv;
|
||||
|
||||
if (priv->values->appearance.overline_rgba)
|
||||
gdk_rgba_free (priv->values->appearance.overline_rgba);
|
||||
priv->values->appearance.overline_rgba = NULL;
|
||||
|
||||
if (rgba)
|
||||
{
|
||||
priv->values->appearance.overline_rgba = gdk_rgba_copy (rgba);
|
||||
|
||||
if (!priv->overline_rgba_set)
|
||||
{
|
||||
priv->overline_rgba_set = TRUE;
|
||||
g_object_notify (G_OBJECT (tag), "overline-rgba-set");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->overline_rgba_set)
|
||||
{
|
||||
priv->overline_rgba_set = FALSE;
|
||||
g_object_notify (G_OBJECT (tag), "overline-rgba-set");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_strikethrough_rgba (GtkTextTag *tag,
|
||||
const GdkRGBA *rgba)
|
||||
@@ -1373,6 +1485,21 @@ 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;
|
||||
priv->values->appearance.rise = g_value_get_int (value);
|
||||
@@ -1453,6 +1580,24 @@ gtk_text_tag_set_property (GObject *object,
|
||||
g_object_notify (object, "font-features-set");
|
||||
break;
|
||||
|
||||
case PROP_ALLOW_BREAKS:
|
||||
priv->allow_breaks_set = TRUE;
|
||||
priv->values->no_breaks = !g_value_get_boolean (value);
|
||||
g_object_notify (object, "allow-breaks-set");
|
||||
break;
|
||||
|
||||
case PROP_SHOW_SPACES:
|
||||
priv->show_spaces_set = TRUE;
|
||||
priv->values->show_spaces = g_value_get_flags (value);
|
||||
g_object_notify (object, "show-spaces-set");
|
||||
break;
|
||||
|
||||
case PROP_INSERT_HYPHENS:
|
||||
priv->insert_hyphens_set = TRUE;
|
||||
priv->values->no_hyphens = !g_value_get_boolean (value);
|
||||
g_object_notify (object, "insert-hyphens-set");
|
||||
break;
|
||||
|
||||
case PROP_ACCUMULATIVE_MARGIN:
|
||||
priv->accumulative_margin = g_value_get_boolean (value);
|
||||
g_object_notify (object, "accumulative-margin");
|
||||
@@ -1557,6 +1702,16 @@ gtk_text_tag_set_property (GObject *object,
|
||||
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);
|
||||
size_changed = TRUE;
|
||||
@@ -1597,6 +1752,18 @@ gtk_text_tag_set_property (GObject *object,
|
||||
priv->font_features_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_ALLOW_BREAKS_SET:
|
||||
priv->allow_breaks_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_SHOW_SPACES_SET:
|
||||
priv->show_spaces_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_INSERT_HYPHENS_SET:
|
||||
priv->insert_hyphens_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -1746,6 +1913,17 @@ gtk_text_tag_get_property (GObject *object,
|
||||
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);
|
||||
break;
|
||||
@@ -1784,6 +1962,18 @@ gtk_text_tag_get_property (GObject *object,
|
||||
g_value_set_string (value, priv->values->font_features);
|
||||
break;
|
||||
|
||||
case PROP_ALLOW_BREAKS:
|
||||
g_value_set_boolean (value, !priv->values->no_breaks);
|
||||
break;
|
||||
|
||||
case PROP_SHOW_SPACES:
|
||||
g_value_set_flags (value, priv->values->show_spaces);
|
||||
break;
|
||||
|
||||
case PROP_INSERT_HYPHENS:
|
||||
g_value_set_boolean (value, !priv->values->no_hyphens);
|
||||
break;
|
||||
|
||||
case PROP_ACCUMULATIVE_MARGIN:
|
||||
g_value_set_boolean (value, priv->accumulative_margin);
|
||||
break;
|
||||
@@ -1866,6 +2056,16 @@ gtk_text_tag_get_property (GObject *object,
|
||||
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);
|
||||
break;
|
||||
@@ -1902,6 +2102,18 @@ gtk_text_tag_get_property (GObject *object,
|
||||
g_value_set_boolean (value, priv->font_features_set);
|
||||
break;
|
||||
|
||||
case PROP_ALLOW_BREAKS_SET:
|
||||
g_value_set_boolean (value, priv->allow_breaks_set);
|
||||
break;
|
||||
|
||||
case PROP_SHOW_SPACES_SET:
|
||||
g_value_set_boolean (value, priv->show_spaces_set);
|
||||
break;
|
||||
|
||||
case PROP_INSERT_HYPHENS_SET:
|
||||
g_value_set_boolean (value, priv->insert_hyphens_set);
|
||||
break;
|
||||
|
||||
case PROP_BACKGROUND:
|
||||
case PROP_FOREGROUND:
|
||||
case PROP_PARAGRAPH_BACKGROUND:
|
||||
|
||||
@@ -59,6 +59,7 @@ struct _GtkTextTagPrivate
|
||||
guint bg_color_set : 1;
|
||||
guint fg_color_set : 1;
|
||||
guint underline_rgba_set : 1;
|
||||
guint overline_rgba_set : 1;
|
||||
guint strikethrough_rgba_set : 1;
|
||||
guint scale_set : 1;
|
||||
guint justification_set : 1;
|
||||
@@ -72,6 +73,7 @@ struct _GtkTextTagPrivate
|
||||
guint pixels_inside_wrap_set : 1;
|
||||
guint tabs_set : 1;
|
||||
guint underline_set : 1;
|
||||
guint overline_set : 1;
|
||||
guint wrap_mode_set : 1;
|
||||
guint bg_full_height_set : 1;
|
||||
guint invisible_set : 1;
|
||||
@@ -81,6 +83,9 @@ struct _GtkTextTagPrivate
|
||||
guint fallback_set : 1;
|
||||
guint letter_spacing_set : 1;
|
||||
guint font_features_set : 1;
|
||||
guint allow_breaks_set : 1;
|
||||
guint show_spaces_set : 1;
|
||||
guint insert_hyphens_set : 1;
|
||||
|
||||
/* Whether these margins accumulate or override */
|
||||
guint accumulative_margin : 1;
|
||||
|
||||
@@ -27,7 +27,7 @@ else
|
||||
endif
|
||||
|
||||
glib_req = '>= @0@.@1@.@2@'.format(glib_major_req, glib_minor_req, glib_micro_req)
|
||||
pango_req = '>= 1.44.0'
|
||||
pango_req = '>= 1.44.4'
|
||||
fribidi_req = '>= 0.19.7'
|
||||
atk_req = '>= 2.15.1'
|
||||
cairo_req = '>= 1.14.0'
|
||||
|
||||
Reference in New Issue
Block a user