summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-20 10:34:15 -0700
committerMatthias Clasen <mclasen@redhat.com>2019-07-20 11:56:18 -0700
commit62580f2fa5e46d51bb2377d4028471926108bab3 (patch)
tree7472f8a4fb33d6822b4cb853e43e0b38124af542 /pango/pango-attributes.c
parente8f20b6116cca605115b42d5e0a15112193a3bad (diff)
downloadpango-62580f2fa5e46d51bb2377d4028471926108bab3.tar.gz
Add an allow-breaks attribute
Add a new attribute type, and parse allow_breaks="false" in markup. This is useful to prevent hyphenation of words.
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r--pango/pango-attributes.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 54b13795..e522931b 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1179,6 +1179,33 @@ pango_attr_background_alpha_new (guint16 alpha)
return pango_attr_int_new (&klass, (int)alpha);
}
+/**
+ * pango_attr_allow_breaks_new:
+ * @allow_breaks: %TRUE if we line breaks are allowed
+ *
+ * Create a new allow-breaks attribute.
+ *
+ * If breaks are disabled, the range will be kept in a
+ * single run, as far as possible.
+ *
+ * Return value: (transfer full): the newly allocated #PangoAttribute,
+ * which should be freed with pango_attribute_destroy()
+ *
+ * Since: 1.44
+ */
+PangoAttribute *
+pango_attr_allow_breaks_new (gboolean allow_breaks)
+{
+ static const PangoAttrClass klass = {
+ PANGO_ATTR_ALLOW_BREAKS,
+ pango_attr_int_copy,
+ pango_attr_int_destroy,
+ pango_attr_int_equal,
+ };
+
+ return pango_attr_int_new (&klass, (int)allow_breaks);
+}
+
/*
* Attribute List
*/