summaryrefslogtreecommitdiff
path: root/pango/pango-markup.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pango-markup.c')
-rw-r--r--pango/pango-markup.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index a9df8ed0..65396547 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -1217,6 +1217,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
const char *strikethrough = NULL;
const char *strikethrough_color = NULL;
const char *rise = NULL;
+ const char *baseline_shift = NULL;
const char *letter_spacing = NULL;
const char *lang = NULL;
const char *fallback = NULL;
@@ -1268,6 +1269,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
CHECK_ATTRIBUTE2(background, "bgcolor");
CHECK_ATTRIBUTE (background_alpha);
CHECK_ATTRIBUTE2(background_alpha, "bgalpha");
+ CHECK_ATTRIBUTE(baseline_shift);
break;
case 'c':
CHECK_ATTRIBUTE2(foreground, "color");
@@ -1675,6 +1677,28 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
add_attribute (tag, pango_attr_rise_new (n));
}
+ if (G_UNLIKELY (baseline_shift))
+ {
+ gint shift = 0;
+
+ if (span_parse_enum ("baseline_shift", baseline_shift, PANGO_TYPE_BASELINE_SHIFT, (int*)(void*)&shift, line_number, NULL))
+ add_attribute (tag, pango_attr_baseline_shift_new (shift));
+ else if (parse_length (baseline_shift, &shift) && (shift > 1024 || shift < -1024))
+ add_attribute (tag, pango_attr_baseline_shift_new (shift));
+ else
+ {
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ _("Value of 'baseline_shift' attribute on <span> tag on line %d "
+ "could not be parsed; should be 'superscript' or 'subscript' or "
+ "an integer, or a string such as '5.5pt', not '%s'"),
+ line_number, baseline_shift);
+ goto error;
+ }
+
+ }
+
if (G_UNLIKELY (letter_spacing))
{
gint n = 0;