diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-08-22 11:44:25 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-10-31 21:23:59 -0400 |
commit | 27ede8c45f011d5351a38019332f6f3f85c83a32 (patch) | |
tree | 05636f340e78aa75e42dc3b17187781e7fc29759 /pango/pango-markup.c | |
parent | 85bdfead1b36945db251df22b2db6789cbf4cd6c (diff) | |
download | pango-27ede8c45f011d5351a38019332f6f3f85c83a32.tar.gz |
Add an overline attribute
Add a new PangoOverline enum, and overline
and overline_color attributes, which parallel
the attributes we have for underlines and
strikethrough.
For now, the enum just has 'none' and 'single'
values.
Diffstat (limited to 'pango/pango-markup.c')
-rw-r--r-- | pango/pango-markup.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pango/pango-markup.c b/pango/pango-markup.c index 6dce1b2e..c8499ced 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -134,6 +134,13 @@ * : The color of underlines; an RGB color * specification such as '#00FF00' or a color name such as 'red' * + * overline + * : One of 'none' or 'single' + * + * overline_color + * : The color of overlines; an RGB color + * specification such as '#00FF00' or a color name such as 'red' + * * rise * : Vertical displacement, in Pango units. Can be negative for * subscript, positive for superscript. @@ -1326,6 +1333,8 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, const char *background = NULL; const char *underline = NULL; const char *underline_color = NULL; + const char *overline = NULL; + const char *overline_color = NULL; const char *strikethrough = NULL; const char *strikethrough_color = NULL; const char *rise = NULL; @@ -1419,6 +1428,10 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, CHECK_ATTRIBUTE (lang); CHECK_ATTRIBUTE (letter_spacing); break; + case 'o': + CHECK_ATTRIBUTE (overline); + CHECK_ATTRIBUTE (overline_color); + break; case 'u': CHECK_ATTRIBUTE (underline); CHECK_ATTRIBUTE (underline_color); @@ -1661,6 +1674,26 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, add_attribute (tag, pango_attr_underline_color_new (color.red, color.green, color.blue)); } + if (G_UNLIKELY (overline)) + { + PangoOverline ol = PANGO_OVERLINE_NONE; + + if (!span_parse_enum ("overline", overline, PANGO_TYPE_OVERLINE, (int*)(void*)&ol, line_number, error)) + goto error; + + add_attribute (tag, pango_attr_overline_new (ol)); + } + + if (G_UNLIKELY (overline_color)) + { + PangoColor color; + + if (!span_parse_color ("overline_color", overline_color, &color, NULL, line_number, error)) + goto error; + + add_attribute (tag, pango_attr_overline_color_new (color.red, color.green, color.blue)); + } + if (G_UNLIKELY (gravity)) { PangoGravity gr = PANGO_GRAVITY_SOUTH; |