diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-25 18:51:44 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-25 18:51:44 +0000 |
commit | c7058b8e34a00efb2abd27180ff3043d817a79e0 (patch) | |
tree | fd719a112f1b552c729fe40ddbe9cd1c89629cc2 /pango/pango-attributes.c | |
parent | 4b2a307f2f7a68fe5ebacbf30218ca3417287228 (diff) | |
parent | b614ea2b06b3c9defaceb92b6904fa8a92249abe (diff) | |
download | pango-c7058b8e34a00efb2abd27180ff3043d817a79e0.tar.gz |
Merge branch 'break-tailoring' into 'main'
Allow more break tailoring with attributes
See merge request GNOME/pango!424
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r-- | pango/pango-attributes.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 28dc4105..326234d2 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -1303,6 +1303,60 @@ pango_attr_show_new (PangoShowFlags flags) } /** + * pango_attr_word_new: + * + * Marks the range of the attribute as a single word. + * + * Note that this may require adjustments to word and + * sentence classification around the range. + * + * Return value: (transfer full): the newly allocated + * `PangoAttribute`, which should be freed with + * [method@Pango.Attribute.destroy] + * + * Since: 1.50 + */ +PangoAttribute * +pango_attr_word_new (void) +{ + static const PangoAttrClass klass = { + PANGO_ATTR_WORD, + pango_attr_int_copy, + pango_attr_int_destroy, + pango_attr_int_equal, + }; + + return pango_attr_int_new (&klass, 0); +} + +/** + * pango_attr_sentence_new: + * + * Marks the range of the attribute as a single sentence. + * + * Note that this may require adjustments to word and + * sentence classification around the range. + * + * Return value: (transfer full): the newly allocated + * `PangoAttribute`, which should be freed with + * [method@Pango.Attribute.destroy] + * + * Since: 1.50 + */ +PangoAttribute * +pango_attr_sentence_new (void) +{ + static const PangoAttrClass klass = { + PANGO_ATTR_SENTENCE, + pango_attr_int_copy, + pango_attr_int_destroy, + pango_attr_int_equal, + }; + + return pango_attr_int_new (&klass, 0); +} + +/** * pango_attr_overline_new: * @overline: the overline style * @@ -1477,6 +1531,8 @@ pango_attribute_as_int (PangoAttribute *attr) case PANGO_ATTR_OVERLINE: case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT: case PANGO_ATTR_TEXT_TRANSFORM: + case PANGO_ATTR_WORD: + case PANGO_ATTR_SENTENCE: return (PangoAttrInt *)attr; default: |