GtkTextView: Support font features

Add a ::font-features attribute to GtkTextTag, and support
font features when inserting Pango markup into a text buffer.
This commit is contained in:
Matthias Clasen
2015-07-29 18:28:56 -04:00
parent 98f9532a22
commit c6838fbff0
6 changed files with 86 additions and 5 deletions

View File

@ -143,6 +143,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (dest->appearance.rgba[1])
gdk_rgba_free (dest->appearance.rgba[1]);
if (dest->font_features)
g_free (dest->font_features);
/* Copy */
orig_refcount = dest->refcount;
@ -170,13 +173,16 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (src->appearance.rgba[1])
dest->appearance.rgba[1] = gdk_rgba_copy (src->appearance.rgba[1]);
if (src->font_features)
dest->font_features = g_strdup (src->font_features);
dest->refcount = orig_refcount;
}
/**
* gtk_text_attributes_ref:
* @values: a #GtkTextAttributes
*
*
* Increments the reference count on @values.
*
* Returns: the #GtkTextAttributes that were passed in
@ -228,6 +234,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (values->appearance.rgba[1])
gdk_rgba_free (values->appearance.rgba[1]);
if (values->font_features)
g_free (values->font_features);
g_slice_free (GtkTextAttributes, values);
}
}
@ -403,6 +412,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (tag->priv->letter_spacing_set)
dest->letter_spacing = vals->letter_spacing;
if (tag->priv->font_features_set)
dest->font_features = g_strdup (vals->font_features);
++n;
}
@ -430,6 +442,7 @@ _gtk_text_tag_affects_size (GtkTextTag *tag)
priv->underline_set ||
priv->wrap_mode_set ||
priv->invisible_set ||
priv->font_features_set ||
priv->letter_spacing_set;
}