diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-29 15:53:48 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-31 14:29:56 -0400 |
commit | fd51b46898ac9c880bb9552c3e301bfef7ac22bd (patch) | |
tree | 5afaca48cf1ecdcac7d4e91c7db80ddb484c5267 /pango/pango-markup.c | |
parent | 303b4fb73eb8848d18abbda4d151461bd86f1000 (diff) | |
download | pango-fd51b46898ac9c880bb9552c3e301bfef7ac22bd.tar.gz |
Implement font-dependent scaling
Add a new font-scale attribute to indicate font size
changes due to super- and subscript shifts, and handle
it during item post-processing to find the right font
sizes.
Diffstat (limited to 'pango/pango-markup.c')
-rw-r--r-- | pango/pango-markup.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pango/pango-markup.c b/pango/pango-markup.c index 65396547..54c08c67 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -1232,6 +1232,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, const char *line_height = NULL; const char *text_transform = NULL; const char *segment = NULL; + const char *font_scale = NULL; g_markup_parse_context_get_position (context, &line_number, &char_number); @@ -1286,6 +1287,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, CHECK_ATTRIBUTE2(style, "font_style"); CHECK_ATTRIBUTE2(variant, "font_variant"); CHECK_ATTRIBUTE2(weight, "font_weight"); + CHECK_ATTRIBUTE(font_scale); CHECK_ATTRIBUTE (foreground); CHECK_ATTRIBUTE2(foreground, "fgcolor"); @@ -1699,6 +1701,16 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, } + if (G_UNLIKELY (font_scale)) + { + PangoFontScale scale; + + if (!span_parse_enum ("font_scale", font_scale, PANGO_TYPE_FONT_SCALE, (int*)(void*)&scale, line_number, error)) + goto error; + + add_attribute (tag, pango_attr_font_scale_new (scale)); + } + if (G_UNLIKELY (letter_spacing)) { gint n = 0; |