summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-attributes.c26
-rw-r--r--pango/pango-attributes.h22
-rw-r--r--pango/pango-markup.c14
3 files changed, 62 insertions, 0 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 5690aeaa..f5d5104b 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1411,6 +1411,32 @@ pango_attr_line_height_new_absolute (int height)
return pango_attr_int_new (&klass, height);
}
+
+/**
+ * pango_attr_text_transform_new:
+ * @transform: `PangoTextTransform` to apply
+ *
+ * Create a new attribute that influences how characters
+ * are transformed during shaping.
+ *
+ * Return value: (transfer full): the newly allocated
+ * `PangoAttribute`, which should be freed with
+ * [method@Pango.Attribute.destroy]
+ *
+ * Since: 1.50
+ */
+PangoAttribute *
+pango_attr_text_transform_new (PangoTextTransform transform)
+{
+ static const PangoAttrClass klass = {
+ PANGO_ATTR_TEXT_TRANSFORM,
+ pango_attr_int_copy,
+ pango_attr_int_destroy,
+ pango_attr_int_equal
+ };
+
+ return pango_attr_int_new (&klass, transform);
+}
/* }}} */
/* {{{ Binding helpers */
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index e3012008..ca0f74b8 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -120,6 +120,7 @@ typedef enum
PANGO_ATTR_OVERLINE_COLOR, /* PangoAttrColor */
PANGO_ATTR_LINE_HEIGHT, /* PangoAttrFloat */
PANGO_ATTR_ABSOLUTE_LINE_HEIGHT, /* PangoAttrInt */
+ PANGO_ATTR_TEXT_TRANSFORM, /* PangoAttrInt */
} PangoAttrType;
/**
@@ -203,6 +204,25 @@ typedef enum {
} PangoShowFlags;
/**
+ * PangoTextTransform:
+ * @PANGO_TEXT_TRANSFORM_NONE: Leave text unchanged
+ * @PANGO_TEXT_TRANSFORM_LOWERCASE: Display letters and numbers as lowercase
+ * @PANGO_TEXT_TRANSFORM_UPPERCASE: Display letters and numbers as uppercase
+ * @PANGO_TEXT_TRANSFORM_CAPITALIZE: Display the first character of a word
+ * in titlecase
+ *
+ * An enumeration that affects how Pango treats characters during shaping.
+ *
+ * Since: 1.50
+ */
+typedef enum {
+ PANGO_TEXT_TRANSFORM_NONE,
+ PANGO_TEXT_TRANSFORM_LOWERCASE,
+ PANGO_TEXT_TRANSFORM_UPPERCASE,
+ PANGO_TEXT_TRANSFORM_CAPITALIZE,
+} PangoTextTransform;
+
+/**
* PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING:
*
* Value for @start_index in `PangoAttribute` that indicates
@@ -532,6 +552,8 @@ PANGO_AVAILABLE_IN_1_50
PangoAttribute * pango_attr_line_height_new (double factor);
PANGO_AVAILABLE_IN_1_50
PangoAttribute * pango_attr_line_height_new_absolute (int height);
+PANGO_AVAILABLE_IN_1_50
+PangoAttribute * pango_attr_text_transform_new (PangoTextTransform transform);
PANGO_AVAILABLE_IN_1_50
PangoAttrString * pango_attribute_as_string (PangoAttribute *attr);
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index a897a52d..f82aacef 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -1226,6 +1226,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
const char *insert_hyphens = NULL;
const char *show = NULL;
const char *line_height = NULL;
+ const char *text_transform = NULL;
g_markup_parse_context_get_position (context,
&line_number, &char_number);
@@ -1294,6 +1295,9 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
CHECK_ATTRIBUTE (strikethrough_color);
CHECK_ATTRIBUTE (style);
break;
+ case 't':
+ CHECK_ATTRIBUTE (text_transform);
+ break;
case 'g':
CHECK_ATTRIBUTE (gravity);
CHECK_ATTRIBUTE (gravity_hint);
@@ -1637,6 +1641,16 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
add_attribute (tag, pango_attr_show_new (flags));
}
+ if (G_UNLIKELY (text_transform))
+ {
+ PangoTextTransform tf;
+
+ if (!span_parse_enum ("text_transform", text_transform, PANGO_TYPE_TEXT_TRANSFORM, (int*)(void*)&tf, line_number, error))
+ goto error;
+
+ add_attribute (tag, pango_attr_text_transform_new (tf));
+ }
+
if (G_UNLIKELY (rise))
{
gint n = 0;