summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-04 09:43:08 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-08-04 10:37:44 -0400
commit2e6f2eb8148220b09d4834065d53c73a3ac2427b (patch)
tree9fce36e84330531009328f2054262a4f3eddd68f /pango/pango-attributes.c
parent1284511871dd80592ef862fcc5ccb5639ac9fe0e (diff)
downloadpango-2e6f2eb8148220b09d4834065d53c73a3ac2427b.tar.gz
Add an insert-hyphens attribute
Add a text attribute that allows to suppress insertion of hyphens at intra-word line breaks. This is useful for non-paragraph-like contexts, where line breaks are needed, but hyphens are not expected.
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 2f02e264..9a80f0e1 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1207,6 +1207,33 @@ pango_attr_allow_breaks_new (gboolean allow_breaks)
}
/**
+ * pango_attr_insert_hyphens_new:
+ * @insert_hyphens: %TRUE if hyphens should be inserted
+ *
+ * Create a new insert-hyphens attribute.
+ *
+ * Pango will insert hyphens when breaking lines in the middle
+ * of a word. This attribute can be used to suppress the hyphen.
+ *
+ * Return value: (transfer full): the newly allocated #PangoAttribute,
+ * which should be freed with pango_attribute_destroy()
+ *
+ * Since: 1.44
+ */
+PangoAttribute *
+pango_attr_insert_hyphens_new (gboolean insert_hyphens)
+{
+ static const PangoAttrClass klass = {
+ PANGO_ATTR_INSERT_HYPHENS,
+ pango_attr_int_copy,
+ pango_attr_int_destroy,
+ pango_attr_int_equal,
+ };
+
+ return pango_attr_int_new (&klass, (int)insert_hyphens);
+}
+
+/**
* pango_attr_show_new:
* @flags: #PangoShowFlags to apply
*